jshttp

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToBody

func ToBody(streamOrNull js.Value) io.ReadCloser

ToBody converts JavaScript sides ReadableStream (can be null) to io.ReadCloser.

func ToHeader

func ToHeader(headers js.Value) http.Header

ToHeader converts JavaScript sides Headers to http.Header.

func ToJSHeader

func ToJSHeader(header http.Header) js.Value

ToJSHeader converts http.Header to JavaScript sides Headers.

func ToJSRequest

func ToJSRequest(req *http.Request) js.Value

ToJSRequest converts *http.Request to JavaScript sides Request.

func ToJSResponse

func ToJSResponse(res *http.Response) js.Value

ToJSResponse converts *http.Response to JavaScript sides Response class object.

func ToRequest

func ToRequest(req js.Value) (*http.Request, error)

ToRequest converts JavaScript sides Request to *http.Request.

func ToResponse

func ToResponse(res js.Value) (*http.Response, error)

ToResponse converts JavaScript sides Response to *http.Response.

Types

type ResponseWriter

type ResponseWriter struct {
	HeaderValue http.Header
	StatusCode  int
	Reader      *io.PipeReader
	Writer      *io.PipeWriter
	ReadyCh     chan struct{}
	Once        sync.Once
}

func (*ResponseWriter) Header

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

func (*ResponseWriter) Ready

func (w *ResponseWriter) Ready()

Ready indicates that ResponseWriter is ready to be converted to Response.

func (*ResponseWriter) ToJSResponse

func (w *ResponseWriter) ToJSResponse() js.Value

ToJSResponse converts *ResponseWriter to JavaScript sides Response.

func (*ResponseWriter) Write

func (w *ResponseWriter) Write(data []byte) (n int, err error)

func (*ResponseWriter) WriteHeader

func (w *ResponseWriter) WriteHeader(statusCode int)

Jump to

Keyboard shortcuts

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