http

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

README

Obelus.one HTTP Library

Disclaimer

It is not a production-ready solution. It is a part of the Obelus.one/NEUdp projects that are under development. We believe it will grow in future, but be aware this may contain bugs and vulnerabilities as well as it will be changed.

Installation

go get gitlab.com/obelus-one/go/http

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Method

func Method(handlers MethodMap) http.HandlerFunc

func Panic

func Panic(handler http.HandlerFunc) http.HandlerFunc

func ReadHeaders

func ReadHeaders(request *http.Request, headersDto interface{}) error

func ReadJson

func ReadJson(request *http.Request, requestDto interface{}) error

func ReadPath

func ReadPath(request *http.Request, pathDto interface{}) error

func ReadQuery

func ReadQuery(request *http.Request, queryDto interface{}) error

func WriteResponse

func WriteResponse(ctx WriteResponseContext, writer http.ResponseWriter, options ...WriteOption) error

Types

type Headers

type Headers map[string][]string

func NewHeaders added in v0.1.1

func NewHeaders() Headers

func (Headers) Add added in v0.1.1

func (headers Headers) Add(key, value string)

func (Headers) Clone added in v0.1.1

func (headers Headers) Clone() Headers

func (Headers) Get added in v0.1.1

func (headers Headers) Get(key string) string

func (Headers) Set added in v0.1.1

func (headers Headers) Set(key, value string)

type MethodMap

type MethodMap map[string]http.HandlerFunc

type WriteOption

type WriteOption func(*writeOptions)

func Code

func Code(code int) WriteOption

func Fail

func Fail(message string) WriteOption
func Header(key, value string) WriteOption

func Message

func Message(message string) WriteOption

func Payload

func Payload(payload any) WriteOption

type WriteResponseContext

type WriteResponseContext interface {
	DefaultHeaders() Headers
}

Jump to

Keyboard shortcuts

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