github.com/cloudreve/Cloudreve/v3@v3.0.0-20240224133659-3edb00a6484c/pkg/serializer/auth.go (about)

     1  package serializer
     2  
     3  import "encoding/json"
     4  
     5  // RequestRawSign 待签名的HTTP请求
     6  type RequestRawSign struct {
     7  	Path   string
     8  	Header string
     9  	Body   string
    10  }
    11  
    12  // NewRequestSignString 返回JSON格式的待签名字符串
    13  func NewRequestSignString(path, header, body string) string {
    14  	req := RequestRawSign{
    15  		Path:   path,
    16  		Header: header,
    17  		Body:   body,
    18  	}
    19  	res, _ := json.Marshal(req)
    20  	return string(res)
    21  }