Documentation
¶
Index ¶
- func ToBody(streamOrNull js.Value) io.ReadCloser
- func ToHeader(headers js.Value) http.Header
- func ToJSHeader(header http.Header) js.Value
- func ToJSRequest(req *http.Request) js.Value
- func ToJSResponse(res *http.Response) js.Value
- func ToRequest(req js.Value) (*http.Request, error)
- func ToResponse(res js.Value) (*http.Response, error)
- type ResponseWriter
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.
- ReadableStream: https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream
func ToJSHeader ¶
ToJSHeader converts http.Header to JavaScript sides Headers.
func ToJSRequest ¶
ToJSRequest converts *http.Request to JavaScript sides Request.
func ToJSResponse ¶
ToJSResponse converts *http.Response to JavaScript sides Response class object.
func ToResponse ¶
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) WriteHeader ¶
func (w *ResponseWriter) WriteHeader(statusCode int)
Click to show internal directories.
Click to hide internal directories.