internal

package
v0.0.0-...-e43970d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestRedirectError  = "error"
	RequestRedirectFollow = "follow"
	RequestRedirectManual = "manual"
)

Variables

This section is empty.

Functions

func ParseRequestURL

func ParseRequestURL(rawURL string) (*url.URL, error)

parse and check the request URL, return *url.URL

Types

type Request

type Request struct {
	Body     string
	Method   string
	Redirect string

	Header     http.Header
	URL        *url.URL
	RemoteAddr string
}

Request is the request object used by fetch

type RequestInit

type RequestInit struct {
	Body     string            `json:"body"`
	Headers  map[string]string `json:"headers"`
	Method   string            `json:"method"`
	Redirect string            `json:"redirect"`
}

RequestInit is the fetch API defined object. Only supports raw request now.

type Response

type Response struct {
	Header     http.Header
	Status     int32
	StatusText string
	OK         bool
	Redirected bool
	URL        string
	Body       string
}

Response keeps the *http.Response

func HandleHttpResponse

func HandleHttpResponse(res *http.Response, url string, redirected bool) (*Response, error)

Handle the *http.Response, return *Response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL