package response
import "miniflux.app/http/response"
Index ¶
- type Builder
- func New(w http.ResponseWriter, r *http.Request) *Builder
- func (b *Builder) WithAttachment(filename string) *Builder
- func (b *Builder) WithBody(body interface{}) *Builder
- func (b *Builder) WithCaching(etag string, duration time.Duration, callback func(*Builder))
- func (b *Builder) WithHeader(key, value string) *Builder
- func (b *Builder) WithStatus(statusCode int) *Builder
- func (b *Builder) WithoutCompression() *Builder
- func (b *Builder) Write()
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder generates HTTP responses.
func New ¶
func New(w http.ResponseWriter, r *http.Request) *Builder
New creates a new response builder.
func (*Builder) WithAttachment ¶
WithAttachment forces the document to be downloaded by the web browser.
func (*Builder) WithBody ¶
WithBody uses the given body to build the response.
func (*Builder) WithCaching ¶
WithCaching adds caching headers to the response.
func (*Builder) WithHeader ¶
WithHeader adds the given HTTP header to the response.
func (*Builder) WithStatus ¶
WithStatus uses the given status code to build the response.
func (*Builder) WithoutCompression ¶
WithoutCompression disables HTTP compression.
func (*Builder) Write ¶
func (b *Builder) Write()
Write generates the HTTP response.
Source Files ¶
builder.go
Directories ¶
Path | Synopsis |
---|---|
http/response/html | |
http/response/json | |
http/response/xml |
- Version
- v1.0.46 (latest)
- Published
- Jul 22, 2023
- Platform
- linux/amd64
- Imports
- 8 packages
- Last checked
- 2 weeks ago –
Tools for package owners.