MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / Encode

Method Encode

mcp-server/param.go:70–87  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68}
69
70func (p *BodyParam) Encode() (string, error) {
71 switch p.contentType {
72 case ContentTypeJSON:
73 data, err := json.Marshal(p.params)
74 if err != nil {
75 return "", fmt.Errorf("body param encode error: %w", err)
76 }
77 return string(data), nil
78 case ContentTypeForm, ContentTypeFile:
79 data := url.Values{}
80 for k, v := range p.params {
81 data.Set(k, fmt.Sprintf("%v", v))
82 }
83 return data.Encode(), nil
84 default:
85 return "", fmt.Errorf("unsupported content type: %s", p.contentType)
86 }
87}

Callers 6

generateInvokeToolFunction · 0.95
saveTemplateFunction · 0.80
InvokeMethod · 0.80
ThirdLoginMethod · 0.80
SendRequestFunction · 0.80
sendFunction · 0.80

Calls 2

MarshalMethod · 0.80
SetMethod · 0.65

Tested by

no test coverage detected