rq: github.com/ddo/rq Index | Files | Directories

package rq

import "github.com/ddo/rq"


Package Files

json.go request.go rq.go

type Rq Uses

type Rq struct {
    URL    string `json:"url"`
    Method string `json:"method"`

    Query  map[string][]string `json:"query"`
    Form   map[string][]string `json:"form"`
    Header map[string][]string `json:"header"`

    Body io.Reader `json:"-"`

Rq contains nicer http request interface components

func Delete Uses

func Delete(URL string) *Rq

Delete is a shortcut of #New

func Get Uses

func Get(URL string) *Rq

Get is a shortcut of #New

func Head(URL string) *Rq

Head is a shortcut of #New

func New Uses

func New(method, URL string) *Rq

New returms empty Rq object

func NewFromJSON Uses

func NewFromJSON(data []byte) (r *Rq, err error)

NewFromJSON create Rq object from json

func Post Uses

func Post(URL string) *Rq

Post is a shortcut of #New

func Put Uses

func Put(URL string) *Rq

Put is a shortcut of #New

func (*Rq) JSONify Uses

func (r *Rq) JSONify() ([]byte, error)

JSONify returns Rq object in json

func (*Rq) ParseRequest Uses

func (r *Rq) ParseRequest() (req *http.Request, err error)

ParseRequest parses Rq as http.Request

func (*Rq) Qs Uses

func (r *Rq) Qs(key string, value ...string)

Qs appends request query

func (*Rq) Send Uses

func (r *Rq) Send(key string, value ...string)

Send appends request form

func (*Rq) SendRaw Uses

func (r *Rq) SendRaw(reader io.Reader)

SendRaw sets request body directly and override the #Send

func (*Rq) Set Uses

func (r *Rq) Set(key string, value ...string)

Set appends request header

func (*Rq) String Uses

func (rq *Rq) String() string

func (*Rq) UnQs Uses

func (r *Rq) UnQs(key string)

UnQs unsets request query

func (*Rq) UnSend Uses

func (r *Rq) UnSend(key string)

UnSend unsets request form

func (*Rq) UnSendRaw Uses

func (r *Rq) UnSendRaw()

UnSendRaw unsets request body

func (*Rq) UnSet Uses

func (r *Rq) UnSet(key string)

UnSet unsets request header



Package rq imports 6 packages (graph) and is imported by 5 packages. Updated 2019-09-06. Refresh now. Tools for package owners.