response

package
v0.0.0-...-ecab513 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package response contains everything related to HTTP responses.

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
Package html contains HTML response functions.
Package html contains HTML response functions.
Package xml contains XML response functions.
Package xml contains XML response functions.

Jump to

Keyboard shortcuts

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