MCPcopy Index your code
hub / github.com/oapi-codegen/oapi-codegen / NewPostBothRequestWithBody

Function NewPostBothRequestWithBody

internal/test/client/client.gen.go:290–316  ·  view source on GitHub ↗

NewPostBothRequestWithBody generates requests for PostBoth with any type of body

(server string, contentType string, body io.Reader)

Source from the content-addressed store, hash-verified

288
289// NewPostBothRequestWithBody generates requests for PostBoth with any type of body
290func NewPostBothRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
291 var err error
292
293 serverURL, err := url.Parse(server)
294 if err != nil {
295 return nil, err
296 }
297
298 operationPath := fmt.Sprintf("/with_both_bodies")
299 if operationPath[0] == '/' {
300 operationPath = "." + operationPath
301 }
302
303 queryURL, err := serverURL.Parse(operationPath)
304 if err != nil {
305 return nil, err
306 }
307
308 req, err := http.NewRequest(http.MethodPost, queryURL.String(), body)
309 if err != nil {
310 return nil, err
311 }
312
313 req.Header.Add("Content-Type", contentType)
314
315 return req, nil
316}
317
318// NewGetBothRequest generates requests for GetBoth
319func NewGetBothRequest(server string) (*http.Request, error) {

Callers 2

PostBothWithBodyMethod · 0.85
NewPostBothRequestFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…