Documentation ¶
Index ¶
- Variables
- type Application
- func (a *Application) AddContentDecoder(token string, decoder encodings.Decoder)
- func (a *Application) AddDefaultHeader(key string, values ...string)
- func (a *Application) DeleteDefaultHeader(key string)
- func (a *Application) Serve(r router.Router, optionalSettings ...settings.Settings) error
- func (a *Application) SetDefaultHeaders(headers map[string][]string)
- func (a *Application) Shutdown()
- func (a *Application) Wait()
Constants ¶
This section is empty.
Variables ¶
var DefaultHeaders = map[string][]string{ "Accept-Encodings": nil, }
DefaultHeaders are headers that are going to be sent unless they were overridden by user.
WARNING: if you want to edit them, do it using Application.AddDefaultHeader or Application.DeleteDefaultHeader instead
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
Application is just a struct with addr and shutdown channel that is currently not used. Planning to replace it with context.WithCancel()
func NewApp ¶
func NewApp(addr string) *Application
NewApp returns a new application object with initialized shutdown chan
func (*Application) AddContentDecoder ¶
func (a *Application) AddContentDecoder(token string, decoder encodings.Decoder)
AddContentDecoder simply adds a new content decoder
func (*Application) AddDefaultHeader ¶
func (a *Application) AddDefaultHeader(key string, values ...string)
func (*Application) DeleteDefaultHeader ¶
func (a *Application) DeleteDefaultHeader(key string)
func (*Application) Serve ¶
Serve takes a router and someSettings, that must be only 0 or 1 elements otherwise, error is returned Also, if specified, Accept-Encodings default header's value will be set here
func (*Application) SetDefaultHeaders ¶
func (a *Application) SetDefaultHeaders(headers map[string][]string)
SetDefaultHeaders overrides default headers to a passed ones. Doing this, make sure you know what are you doing
func (*Application) Shutdown ¶
func (a *Application) Shutdown()
Shutdown gracefully shutting down the server. It is not blocking, server being shut down right after calling this method is not guaranteed, because tcp server will wait for the next connection, and only then he'll be able to receive a shutdown notify. Moreover, tcp server will wait until all the existing connections will be closed