JSON writes data as JSON to the server.
(ctx context.Context, method, urlpath string, payload interface{}, opts ...RequestOption)
| 310 | |
| 311 | // JSON writes data as JSON to the server. |
| 312 | func (c *Client) JSON(ctx context.Context, method, urlpath string, payload interface{}, opts ...RequestOption) (*http.Response, error) { |
| 313 | opts = append(opts, RequestHeader(true, contentTypeKey, contentTypeJSON)) |
| 314 | return c.Do(ctx, method, urlpath, payload, opts...) |
| 315 | } |
| 316 | |
| 317 | // JSON writes form data to the server. |
| 318 | func (c *Client) Form(ctx context.Context, method, urlpath string, formValues url.Values, opts ...RequestOption) (*http.Response, error) { |