fasthttpadaptor

package
v0.0.0-...-81ebe4c Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2016 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package fasthttpadaptor provides helper functions for converting net/http request handlers to fasthttp request handlers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFastHTTPHandler

func NewFastHTTPHandler(h http.Handler) fasthttp.RequestHandler

NewFastHTTPHandler wraps net/http handler to fasthttp request handler, so it can be passed to fasthttp server.

While this function may be used for easy switching from net/http to fasthttp, it has the following drawbacks comparing to using manually written fasthttp request handler:

  • A lot of useful functionality provided by fasthttp is missing from net/http handler.
  • net/http -> fasthttp handler conversion has some overhead, so the returned handler will be always slower than manually written fasthttp handler.

So it is advisable using this function only for quick net/http -> fasthttp switching. Then manually convert net/http handlers to fasthttp handlers according to https://github.com/valyala/fasthttp#switching-from-nethttp-to-fasthttp .

func NewFastHTTPHandlerFunc

func NewFastHTTPHandlerFunc(h http.HandlerFunc) fasthttp.RequestHandler

NewFastHTTPHandlerFunc wraps net/http handler func to fasthttp request handler, so it can be passed to fasthttp server.

While this function may be used for easy switching from net/http to fasthttp, it has the following drawbacks comparing to using manually written fasthttp request handler:

  • A lot of useful functionality provided by fasthttp is missing from net/http handler.
  • net/http -> fasthttp handler conversion has some overhead, so the returned handler will be always slower than manually written fasthttp handler.

So it is advisable using this function only for quick net/http -> fasthttp switching. Then manually convert net/http handlers to fasthttp handlers according to https://github.com/valyala/fasthttp#switching-from-nethttp-to-fasthttp .

Types

This section is empty.

Jump to

Keyboard shortcuts

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