Versions in this module Expand all Collapse all v0 v0.3.3 Jul 5, 2021 v0.3.2 Jun 17, 2021 Changes in this version + const DELETE + const GET + const HEAD + const OPTIONS + const PATCH + const POST + const PUT + var ErrFileInfo = errors.New("nic: Invalid file information") + var ErrHookFuncMaxLimit = errors.New("nic: The number of hook functions must be less than 8") + var ErrIndexOutofBound = errors.New("nic: Index out of bound") + var ErrInvalidMethod = errors.New("nic: Method is invalid") + var ErrNotJsonResponse = errors.New("nic: Not a Json response") + var ErrParamConflict = errors.New("nic: Options param conflict") + var ErrUnrecognizedEncoding = errors.New("nic: Unrecognized encoding") + type AfterResponseHookFunc func(*http.Response) error + type BeforeRequestHookFunc func(*http.Request) error + type F struct + FileName string + FilePath string + MimeType string + Src []byte + func File(filename string, src []byte) *F + func FileFromPath(path string) *F + func (f *F) FName(filename string) *F + func (f *F) MIME(mimetype string) *F + type H struct + AllowRedirect bool + Auth KV + Chunked bool + Cookies KV + Data KV + DisableCompression bool + DisableKeepAlives bool + Files KV + Headers KV + JSON KV + Params KV + Proxy string + Raw string + SkipVerifyTLS bool + Timeout int64 + type KV map[string]interface + type Option interface + type Response struct + Bytes []byte + Text string + func Delete(url string, option Option) (*Response, error) + func Get(url string, option Option) (*Response, error) + func Head(url string, option Option) (*Response, error) + func NewResponse(r *http.Response) (*Response, error) + func Options(url string, option Option) (*Response, error) + func Patch(url string, option Option) (*Response, error) + func Post(url string, option Option) (*Response, error) + func Put(url string, option Option) (*Response, error) + func (r *Response) SetEncode(e string) error + func (r Response) GetEncode() string + func (r Response) JSON(s interface{}) error + func (r Response) SaveFile(filename string) error + type Session struct + Client *http.Client + func NewSession() *Session + func (s *Session) Delete(url string, option Option) (*Response, error) + func (s *Session) Get(url string, option Option) (*Response, error) + func (s *Session) GetRequest() *http.Request + func (s *Session) Head(url string, option Option) (*Response, error) + func (s *Session) Options(url string, option Option) (*Response, error) + func (s *Session) Patch(url string, option Option) (*Response, error) + func (s *Session) Post(url string, option Option) (*Response, error) + func (s *Session) Put(url string, option Option) (*Response, error) + func (s *Session) RegisterAfterRespHook(fn AfterResponseHookFunc) error + func (s *Session) RegisterBeforeReqHook(fn BeforeRequestHookFunc) error + func (s *Session) Request(method string, urlStr string, option Option) (*Response, error) + func (s *Session) ResetAfterRespHook() + func (s *Session) ResetBeforeReqHook() + func (s *Session) UnregisterAfterRespHook(index int) error + func (s *Session) UnregisterBeforeReqHook(index int) error