parent
fd7b6e33c8
commit
90827b2441
@ -0,0 +1,22 @@
|
||||
package serializer
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
// RequestRawSign 待签名的HTTP请求
|
||||
type RequestRawSign struct {
|
||||
Path string
|
||||
Policy string
|
||||
Body string
|
||||
}
|
||||
|
||||
// NewRequestSignString 返回JSON格式的待签名字符串
|
||||
// TODO 测试
|
||||
func NewRequestSignString(path, policy, body string) string {
|
||||
req := RequestRawSign{
|
||||
Path: path,
|
||||
Policy: policy,
|
||||
Body: body,
|
||||
}
|
||||
res, _ := json.Marshal(req)
|
||||
return string(res)
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package serializer
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNewRequestSignString(t *testing.T) {
|
||||
asserts := assert.New(t)
|
||||
|
||||
sign := NewRequestSignString("1", "2", "3")
|
||||
asserts.NotEmpty(sign)
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"github.com/HFO4/cloudreve/pkg/serializer"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// SlaveUpload 从机文件上传
|
||||
func SlaveUpload(c *gin.Context) {
|
||||
|
||||
c.JSON(200, serializer.Response{
|
||||
Code: 0,
|
||||
})
|
||||
}
|
Loading…
Reference in new issue