GithubHelp home page GithubHelp logo

ckrequest's Introduction

ckRequest

Feature

  • 支持重定向过程中逐步请求的cookie/set-cookie查看
  • 支持cookie的导入导出
  • 简单的api用于设置POST请求的body和content-type
    • 支持form,json,multipart,binary

doc

package ckRequest // import "ckRequest"


FUNCTIONS

func DefaultRedirectCb(req *http.Request, via []*http.Request) error
func DisableRedirectCb(req *http.Request, via []*http.Request) error

TYPES

type Clienter interface {
        Do(req *HttpReq) *HttpResp
}

type File struct {
        FilePath string
}

type HttpClient struct {
        Cl *http.Client
}

var DefaultClient *HttpClient
func NewClient() *HttpClient

// if u want to send req , use NewRequest().Do(client)
func (c *HttpClient) Do(req *HttpReq) *HttpResp

func (c *HttpClient) DisableKeepAlive()
func (c *HttpClient) SetProxy(addr string)

func (c *HttpClient) PostJson(url, body string) *HttpResp

func (c *HttpClient) StoreCookies(filepath string) error

type HttpReq struct {
        *http.Request
}

func Get(url string) *HttpReq

func NewRequest(method, url string, body io.Reader) *HttpReq

func Post(url string, body io.Reader) *HttpReq

func PostForm(url string, body string) *HttpReq
    body can be built using url.Values{}.encode

func PostFormAny(url_ string, body interface{}) *HttpReq
    body should be a struct{anyType} ,
    map[interface{}]interface{},map[interface{}][]interface{}

func PostJson(url string, body string) *HttpReq

func PostMIMEJpg(url string, img []byte) *HttpReq

func PostMultiPart(url string, body map[string]interface{}) *HttpReq
    use "mime/multipart"

func (r *HttpReq) Do(c Clienter) *HttpResp

func (r *HttpReq) Form() *HttpReq

func (r *HttpReq) Jpeg() *HttpReq

func (r *HttpReq) Json() *HttpReq

func (r *HttpReq) Origin(origin string) *HttpReq

func (r *HttpReq) Referer(referer string) *HttpReq

type HttpResp struct {
        *http.Response
        Err error
        // Has unexported fields.
}

func (resp *HttpResp) Bytes() []byte

func (resp *HttpResp) Reader() *bytes.Reader

func (resp *HttpResp) String() string

ckrequest's People

Contributors

wymli avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.