Documentation ¶
Index ¶
- Variables
- type F
- type H
- type KV
- type Response
- func Connect(url string, options *H) (*Response, error)
- func Delete(url string, options *H) (*Response, error)
- func Get(url string, options *H) (*Response, error)
- func Head(url string, options *H) (*Response, error)
- func Options(url string, options *H) (*Response, error)
- func Patch(url string, options *H) (*Response, error)
- func Post(url string, options *H) (*Response, error)
- func Put(url string, options *H) (*Response, error)
- func Trace(url string, options *H) (*Response, error)
- type Session
- func (s *Session) ClearCookies()
- func (s *Session) Connect(url string, options *H) (*Response, error)
- func (s *Session) Delete(url string, options *H) (*Response, error)
- func (s *Session) Get(url string, options *H) (*Response, error)
- func (s *Session) GetRequest() *http.Request
- func (s *Session) Head(url string, options *H) (*Response, error)
- func (s *Session) Options(url string, options *H) (*Response, error)
- func (s *Session) Patch(url string, options *H) (*Response, error)
- func (s *Session) Post(url string, options *H) (*Response, error)
- func (s *Session) Put(url string, options *H) (*Response, error)
- func (s *Session) Request(method string, urlStr string, options *H) (*Response, error)
- func (s *Session) Trace(url string, options *H) (*Response, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidMethod will be throwed when method not in // [HEAD, GET, POST, DELETE, OPTIONS, PUT, PATCH, CONNECT, TRACE] ErrInvalidMethod = errors.New("nic: Method is invalid") // ErrFileInfo will be throwed when fileinfo is invalid ErrFileInfo = errors.New("nic: Invalid file information") // ErrParamConflict will be throwed when options params conflict // e.g. files + data // json + data // ... ErrParamConflict = errors.New("nic: Options param conflict") // ErrUnrecognizedEncoding will be throwed while changing response encoding // if encoding is not recognized ErrUnrecognizedEncoding = errors.New("nic: Unrecognized encoding") // ErrNotJsonResponse will be throwed when response not a json // but invoke Json() method ErrNotJsonResponse = errors.New("nic: Not a Json response") )
Functions ¶
This section is empty.
Types ¶
type F ¶
F is for file-upload request
map[string]KV{ "file1" : KV{ // path of file "filename" : "1.txt", "token" : "abc", }, "file2" : KV{...}, }
type H ¶
type H struct { AllowRedirect bool Timeout int64 Data KV Raw string Headers KV Cookies KV Auth KV Proxy string JSON KV Files F }
H struct is options for request and http client
type Response ¶
type Response struct { *http.Response Text string Bytes []byte // contains filtered or unexported fields }
Response is the wrapper for http.Response
type Session ¶
type Session struct { Client *http.Client Cookies []*http.Cookie // contains filtered or unexported fields }
Session is the wrapper for http.Client and http.Request
func (*Session) GetRequest ¶ added in v0.1.1
GetRequest returns nic.Session.request
Click to show internal directories.
Click to hide internal directories.