miniflux.appminiflux.app/http/response Index | Files | Directories

package response

import "miniflux.app/http/response"

Index

Types

type Builder

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

Builder generates HTTP responses.

func New

New creates a new response builder.

func (*Builder) WithAttachment

func (b *Builder) WithAttachment(filename string) *Builder

WithAttachment forces the document to be downloaded by the web browser.

func (*Builder) WithBody

func (b *Builder) WithBody(body interface{}) *Builder

WithBody uses the given body to build the response.

func (*Builder) WithCaching

func (b *Builder) WithCaching(etag string, duration time.Duration, callback func(*Builder))

WithCaching adds caching headers to the response.

func (*Builder) WithHeader

func (b *Builder) WithHeader(key, value string) *Builder

WithHeader adds the given HTTP header to the response.

func (*Builder) WithStatus

func (b *Builder) WithStatus(statusCode int) *Builder

WithStatus uses the given status code to build the response.

func (*Builder) WithoutCompression

func (b *Builder) WithoutCompression() *Builder

WithoutCompression disables HTTP compression.

func (*Builder) Write

func (b *Builder) Write()

Write generates the HTTP response.

Source Files

builder.go

Directories

PathSynopsis
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.