middleware

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package middleware provides the ability for injecting Vela resources into the middleware chain for the API.

Usage:

import "github.com/go-vela/worker/router/middleware"

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Logger

func Logger(logger *logrus.Logger, timeFormat string, utc bool) gin.HandlerFunc

Logger returns a gin.HandlerFunc (middleware) that logs requests using logrus.

Requests with errors are logged using logrus.Error(). Requests without errors are logged using logrus.Info().

It receives:

  1. A time package format string (e.g. time.RFC3339).
  2. A boolean stating whether to use UTC time zone or local.

func NoCache

func NoCache(c *gin.Context)

NoCache is a middleware function that appends headers to prevent the client from caching the HTTP response.

func Options

func Options(c *gin.Context)

Options is a middleware function that appends headers for options requests and aborts then exits the middleware chain and ends the request.

func Payload

func Payload() gin.HandlerFunc

Payload is a middleware function that captures the user provided json body and attaches it to the context of every http.Request to be logged

func RequestVersion

func RequestVersion(c *gin.Context)

RequestVersion is a middleware function that injects the Vela API version information into the request so it will be logged. This is intended for debugging and troubleshooting.

func ResponseVersion

func ResponseVersion(c *gin.Context)

ResponseVersion is a middleware function that injects the Vela API version information into the response so it will be logged. This is intended for debugging and troubleshooting.

func Secure

func Secure(c *gin.Context)

Secure is a middleware function that appends security and resource access headers.

Types

This section is empty.

Jump to

Keyboard shortcuts

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