MCPcopy Create free account
hub / github.com/MarioCarrion/todo-api-microservice-example / NewCreateTaskRequestWithBody

Function NewCreateTaskRequestWithBody

client.gen.go:331–357  ·  view source on GitHub ↗

NewCreateTaskRequestWithBody generates requests for CreateTask with any type of body

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

Source from the content-addressed store, hash-verified

329
330// NewCreateTaskRequestWithBody generates requests for CreateTask with any type of body
331func NewCreateTaskRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
332 var err error
333
334 serverURL, err := url.Parse(server)
335 if err != nil {
336 return nil, err
337 }
338
339 operationPath := fmt.Sprintf("/tasks")
340 if operationPath[0] == '/' {
341 operationPath = "." + operationPath
342 }
343
344 queryURL, err := serverURL.Parse(operationPath)
345 if err != nil {
346 return nil, err
347 }
348
349 req, err := http.NewRequest("POST", queryURL.String(), body)
350 if err != nil {
351 return nil, err
352 }
353
354 req.Header.Add("Content-Type", contentType)
355
356 return req, nil
357}
358
359// NewSearchTaskRequest calls the generic SearchTask builder with application/json body
360func NewSearchTaskRequest(server string, body SearchTaskJSONRequestBody) (*http.Request, error) {

Callers 2

CreateTaskWithBodyMethod · 0.85
NewCreateTaskRequestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected