Documentation
¶
Index ¶
Constants ¶
View Source
const ( METHOD_POST = "POST" METHOD_GET = "GET" )
constant for method post and get
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPRequest ¶
type HTTPRequest struct {
// contains filtered or unexported fields
}
*
- HTTP Request will be used for creating request
- method : method POST or GET
- postContents : contents that will be sent through request
- baseUrl : base url of site (ex : http://www.yoursite.com) . It must be start with http://
- referer : the previous url
- cookies : response cookies from previous page/login page
*
func NewRequest ¶
func NewRequest(method string, baseUrl string, targetUrl string, referer string, formData map[string]string, cookies []*http.Cookie) *HTTPRequest
initialise request
func (*HTTPRequest) CallAndRedirect ¶
func (httpRequest *HTTPRequest) CallAndRedirect() (*HttpReponse, error)
*
- CallAndRedirect use client for send request.
- It is implement cookieJar so if you want to send request using cookies, Use this method
- It is support redirect page *
func (*HTTPRequest) CallWithoutRedirect ¶
func (httpRequest *HTTPRequest) CallWithoutRedirect() (*HttpReponse, error)
*
- CallWithoutRedirect method using roundtrip transport for sending data
- This method doesn't allow cookies when sending data
- It's also doesn't support redirect. Plese refer doc of http.Transport roundtrip
- I usually use this method to get cookie after successfull login *
type HttpReponse ¶
*
- HTTP Response
- RawContent : array of byte from resp.Body
- lastUrl : landing page(redirect page)
- Cookies : cookies from response
*
Click to show internal directories.
Click to hide internal directories.