MCPcopy Create free account
hub / github.com/gogs/gogs / Body

Method Body

internal/httplib/httplib.go:231–243  ·  view source on GitHub ↗

Body adds request raw body. it supports string and []byte.

(data any)

Source from the content-addressed store, hash-verified

229// Body adds request raw body.
230// it supports string and []byte.
231func (r *Request) Body(data any) *Request {
232 switch t := data.(type) {
233 case string:
234 bf := bytes.NewBufferString(t)
235 r.req.Body = io.NopCloser(bf)
236 r.req.ContentLength = int64(len(t))
237 case []byte:
238 bf := bytes.NewBuffer(t)
239 r.req.Body = io.NopCloser(bf)
240 r.req.ContentLength = int64(len(t))
241 }
242 return r
243}
244
245func (r *Request) getResponse() (*http.Response, error) {
246 if r.resp.StatusCode != 0 {

Callers 4

getResponseMethod · 0.95
deliverMethod · 0.80
SanitizeIpynbFunction · 0.80
MarkdownRawFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected