NewGetJsonRequest generates requests for GetJson
(server string)
| 384 | |
| 385 | // NewGetJsonRequest generates requests for GetJson |
| 386 | func NewGetJsonRequest(server string) (*http.Request, error) { |
| 387 | var err error |
| 388 | |
| 389 | serverURL, err := url.Parse(server) |
| 390 | if err != nil { |
| 391 | return nil, err |
| 392 | } |
| 393 | |
| 394 | operationPath := fmt.Sprintf("/with_json_response") |
| 395 | if operationPath[0] == '/' { |
| 396 | operationPath = "." + operationPath |
| 397 | } |
| 398 | |
| 399 | queryURL, err := serverURL.Parse(operationPath) |
| 400 | if err != nil { |
| 401 | return nil, err |
| 402 | } |
| 403 | |
| 404 | req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) |
| 405 | if err != nil { |
| 406 | return nil, err |
| 407 | } |
| 408 | |
| 409 | return req, nil |
| 410 | } |
| 411 | |
| 412 | // NewPostOtherRequestWithBody generates requests for PostOther with any type of body |
| 413 | func NewPostOtherRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { |