http

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package http provides a Scale Runtime Adapter for the Standard net/http library.

Index

Constants

View Source
const (
	BodyLimit = 1024 * 1024 * 10
)

Variables

This section is empty.

Functions

func FromRequest

func FromRequest(ctx *signature.Context, req *http.Request) error

FromRequest serializes http.Request object into a runtime.Context

func FromResponse

func FromResponse(ctx *signature.Context, w *ResponseWriter)

FromResponse serializes the *ResponseWriter object into a runtime.Context

func ToRequest

func ToRequest(ctx *signature.Context, req *http.Request)

ToRequest deserializes the runtime.Context object into an existing http.Request

func ToResponse

func ToResponse(ctx *signature.Context, w http.ResponseWriter) error

ToResponse deserializes the runtime.Context object into the http.ResponseWriter

Types

type HTTP

type HTTP struct {
	// contains filtered or unexported fields
}

HTTP is a Scale Runtime Adapter for the Standard net/http library.

func New

func New(next http.Handler, runtime *runtime.Runtime[*httpSignature.Context]) *HTTP

New returns a new HTTP adapter given a Scale Runtime and an optional net/http.Handler.

func (*HTTP) Next

func (h *HTTP) Next(req *http.Request) runtime.Next[*httpSignature.Context]

func (*HTTP) ServeHTTP

func (h *HTTP) ServeHTTP(w http.ResponseWriter, req *http.Request)

type ResponseWriter

type ResponseWriter struct {
	// contains filtered or unexported fields
}

func NewResponseWriter

func NewResponseWriter() *ResponseWriter

func (*ResponseWriter) Header

func (r *ResponseWriter) Header() http.Header

func (*ResponseWriter) Write

func (r *ResponseWriter) Write(bytes []byte) (int, error)

func (*ResponseWriter) WriteHeader

func (r *ResponseWriter) WriteHeader(statusCode int)

Jump to

Keyboard shortcuts

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