responders

package
v0.0.0-...-77bbea8 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package responders contains implementations of middleware.Responder that can be useful for any endpoint.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InternalServerError

type InternalServerError struct{}

InternalServerError is a middleware.Responder that returns a generic 500 Internal Server Error response.

func (InternalServerError) WriteResponse

func (i InternalServerError) WriteResponse(w http.ResponseWriter, p runtime.Producer)

WriteResponse implements middleware.Responder.

type SoftRedirect

type SoftRedirect struct{ URL string }

SoftRedirect is a middleware.Responder that writes an HTML page to the response that would redirect the user to the provided URL. This can be used instead of a normal HTTP 3XX redirect, as a way to make the browser think the navigation is "same-site" and send SameSite=strict cookies to the server. In particular, SoftRedirect implements this Stack Overflow answer: https://stackoverflow.com/a/42220786/1937836.

func (SoftRedirect) WriteResponse

func (s SoftRedirect) WriteResponse(w http.ResponseWriter, p runtime.Producer)

WriteResponse implements middleware.Responder.

Jump to

Keyboard shortcuts

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