Documentation ¶
Overview ¶
Package http implements crazy ideas for http optimizations that should be mostly std compatible.
Index ¶
- Variables
- func CreateBodyWriter(cb func(w io.Writer) error) io.ReadCloser
- func CreateMultipartBody(cb func(mw *multipart.Writer) error) (body io.ReadCloser, boundary string)
- func MatchContentType(pattern, value string) bool
- func NewRequest(ctx context.Context, method string, u *url.URL) (*http.Request, error)
- func ParseForm(r *http.Request) (url.Values, error)
- func SetBody(req *http.Request, body io.Reader, contentType string)
- func SetCloserBody(req *http.Request, body io.ReadCloser, contentType string)
- type Client
- type MultipartFile
Constants ¶
This section is empty.
Variables ¶
var ErrInternalServerErrorResponse = errors.New("internal server error response")
ErrInternalServerErrorResponse reports that response was a internal server error type.
var ErrNotImplemented = errors.New("not implemented")
ErrNotImplemented reports that handler is not implemented.
Functions ¶
func CreateBodyWriter ¶
func CreateBodyWriter(cb func(w io.Writer) error) io.ReadCloser
CreateBodyWriter is a helper to create a reader from a writer body.
func CreateMultipartBody ¶
CreateMultipartBody is helper for streaming multipart/form-data.
func MatchContentType ¶
MatchContentType returns true if value matches path pattern.
func NewRequest ¶
NewRequest creates a new http.Request.
func ParseForm ¶
ParseForm is optimized version of http.Request.ParseForm.
Difference from http.Request.ParseForm:
- This function does not modify any fields of http.Request. The only copy of the form values is returned.
- This function does not check Content-Type header.
func SetCloserBody ¶
func SetCloserBody(req *http.Request, body io.ReadCloser, contentType string)
SetCloserBody sets request body which should be closed after request.
Types ¶
type MultipartFile ¶
MultipartFile is multipart form file.
func (MultipartFile) WriteMultipart ¶
func (m MultipartFile) WriteMultipart(fieldName string, w *multipart.Writer) error
WriteMultipart writes data from reader to given multipart.Writer as a form file.