Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SendParse ¶
func SendParse[T any](ctx context.Context, client *http.Client, r Request, acceptable ...int) (*T, error)
SendParse is intended for use cases which caller is sure about the response structure. Optionally, caller can provide a number of acceptable status codes. Function will return an error if the response's status code is not in them.
This function requires the caller to specify the response type. Return value will be a pointer of that type, or an error if something goes wrong.
Types ¶
type Request ¶
type Request struct { Method Method URL string Header http.Header Cookies []*http.Cookie Body []byte Params map[string]string }
Request includes all the necessary data for creating an HTTP request. Method can be a string; or be one of the predefined ones by this module. URL must be the full address with all the prefix and suffixes. Header, Cookies and Body are not mandatory and might be filled based on the requirements. Params is a map for providing URL-encoded query parameters.