go-micro: github.com/micro/go-micro/util/http Index | Files

package http

import "github.com/micro/go-micro/util/http"

Index

Package Files

http.go options.go roundtripper.go

func NewRoundTripper Uses

func NewRoundTripper(opts ...Option) http.RoundTripper

func RequestToContext Uses

func RequestToContext(r *http.Request) context.Context

RequestToContext puts the `Authorization` header bearer token into context so calls to services will be authorized.

func Write Uses

func Write(w http.ResponseWriter, contentType string, status int, body string)

Write sets the status and body on a http ResponseWriter

func WriteBadRequestError Uses

func WriteBadRequestError(w http.ResponseWriter, err error)

WriteBadRequestError sets a 400 status code

func WriteInternalServerError Uses

func WriteInternalServerError(w http.ResponseWriter, err error)

WriteInternalServerError sets a 500 status code

type Option Uses

type Option func(*Options)

func WithRouter Uses

func WithRouter(r router.Router) Option

type Options Uses

type Options struct {
    Router router.Router
}

Package http imports 12 packages (graph) and is imported by 3 packages. Updated 2020-08-21. Refresh now. Tools for package owners.