krakend: Index | Files | Directories

package server

import ""


Package Files



const (
    // HeaderCompleteResponseValue is the value of the CompleteResponseHeader
    // if the response is complete
    HeaderCompleteResponseValue = "true"
    // HeaderIncompleteResponseValue is the value of the CompleteResponseHeader
    // if the response is not complete
    HeaderIncompleteResponseValue = "false"


var (
    // CompleteResponseHeaderName is the header to flag incomplete responses to the client
    CompleteResponseHeaderName = "X-KrakenD-Completed"
    // HeadersToSend are the headers to pass from the router request to the proxy
    HeadersToSend = []string{"Content-Type"}
    // UserAgentHeaderValue is the value of the User-Agent header to add to the proxy request
    UserAgentHeaderValue = []string{core.KrakendUserAgent}

    // ErrInternalError is the error returned by the router when something went wrong
    ErrInternalError = errors.New("internal server error")
    // ErrPrivateKey is the error returned by the router when the private key is not defined
    ErrPrivateKey = errors.New("private key not defined")
    // ErrPublicKey is the error returned by the router when the public key is not defined
    ErrPublicKey = errors.New("public key not defined")

func DefaultToHTTPError Uses

func DefaultToHTTPError(_ error) int

DefaultToHTTPError is a ToHTTPError transalator that always returns an internal server error

func InitHTTPDefaultTransport Uses

func InitHTTPDefaultTransport(cfg config.ServiceConfig)

InitHTTPDefaultTransport ensures the default HTTP transport is configured just once per execution

func NewServer Uses

func NewServer(cfg config.ServiceConfig, handler http.Handler) *http.Server

NewServer returns a http.Server ready to serve the injected handler

func ParseTLSConfig Uses

func ParseTLSConfig(cfg *config.TLS) *tls.Config

ParseTLSConfig creates a tls.Config from the TLS section of the service configuration

func RunServer Uses

func RunServer(ctx context.Context, cfg config.ServiceConfig, handler http.Handler) error

RunServer runs a http.Server with the given handler and configuration. It configures the TLS layer if required by the received configuration.

type ToHTTPError Uses

type ToHTTPError func(error) int

ToHTTPError translates an error into a HTTP status code


pluginPackage plugin provides plugin register interfaces for building http handler plugins.

Package server imports 10 packages (graph) and is imported by 2 packages. Updated 2019-12-06. Refresh now. Tools for package owners.