NewPostBothRequestWithBody generates requests for PostBoth with any type of body
(server string, contentType string, body io.Reader)
| 288 | |
| 289 | // NewPostBothRequestWithBody generates requests for PostBoth with any type of body |
| 290 | func 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 |
| 319 | func NewGetBothRequest(server string) (*http.Request, error) { |
no test coverage detected
searching dependent graphs…