func getUrlJson(taskID string, r *http.Request, picOp *plugins.ImageOperate) ([]byte, error) {
	l.Debug("Send url request of task", taskID, "to plugin manager")
	url, err := plugins.GetURL(taskID, r, isServerTLS, picOp)
	if err != nil {
		l.Error("Error happened when get url of task", taskID, ":", err)
		return nil, err
	}
	l.Debug("Get url of task", taskID, "successfully")
	return jsonEncode(url)
}
getUrlJson get url json bytes like {"URL": "http://127.0.0.1/files/filename"}
Will call plugins.GetURL
package apiserver
import (
	"encoding/json"
	"fmt"
	"net/http"
	"github.com/7sDream/rikka/api"
	"github.com/7sDream/rikka/common/util"
	"github.com/7sDream/rikka/plugins"
)
func jsonEncode(obj interface{}) ([]byte, error) {
	jsonData, err := json.Marshal(obj)
	if err == nil {
		l.Debug("Encode data", fmt.Sprint(obj), "to json", string(jsonData), "successfully")
		return jsonData, nil
	}
	l.Error("Error happened when encoding", fmt.Sprint(obj), "to json :", err)
	return nil, err
}
func getErrorJson(err error) ([]byte, error) {
	obj := api.Error{
		Error: err.Error(),
	}
	return jsonEncode(obj)
}
func getTaskIdJson(taskId string) ([]byte, error) {
	obj := api.TaskId{
		TaskId: taskId,
	}
	return jsonEncode(obj)
}
func getStateJson(taskID string) ([]byte, error) {
	l.Debug("Send state request of task", taskID, "to plugin manager")
	state, err := plugins.GetState(taskID)
	if err != nil {
		l.Warn("Error happened when get state of task", taskID, ":", err)
		return nil, err
	}
	l.Debug("Get state of task", taskID, "successfully")
	return jsonEncode(state)
}