response

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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