Documentation
¶
Index ¶
- func BadRequest(client *clients.Client, message string)
- func BadRequestf(client *clients.Client, message string, vars ...any)
- func Content(client *clients.Client, data []byte)
- func ContentType(client *clients.Client, ctype string)
- func Cookie(client *clients.Client, key string, value string)
- func Error(client *clients.Client, err error)
- func EventContent(client *clients.Client, data []byte)
- func Flush(client *clients.Client)
- func Forbidden(client *clients.Client, message string)
- func Forbiddenf(client *clients.Client, message string, vars ...any)
- func Header(client *clients.Client, key string, value string)
- func Headers(client *clients.Client, fields map[string]string)
- func Json(client *clients.Client, value any)
- func Message(client *clients.Client, message string)
- func Messagef(client *clients.Client, format string, vars ...any)
- func Navigate(client *clients.Client, location string)
- func Navigatef(client *clients.Client, format string, vars ...any)
- func NotFound(client *clients.Client, message string)
- func NotFoundf(client *clients.Client, message string, vars ...any)
- func Redirect(client *clients.Client, location string, status int)
- func Redirectf(client *clients.Client, status int, location string, vars ...any)
- func RequestedFile(client *clients.Client) bool
- func SseUpgrade(client *clients.Client) func(event string)
- func Status(client *clients.Client, status int)
- func TooManyRequests(client *clients.Client, message string)
- func TooManyRequestsf(client *clients.Client, message string, vars ...any)
- func Unauthorized(client *clients.Client, message string)
- func Unauthorizedf(client *clients.Client, message string, vars ...any)
- func View(client *clients.Client, view views.View)
- func WsUpgrade(client *clients.Client)
- func WsUpgradeWithUpgrader(client *clients.Client, upgrader websocket.Upgrader)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BadRequest ¶
BadRequest sends a message with status 400 Bad Request.
func BadRequestf ¶ added in v1.46.0
BadRequestf sends a message with status 400 Bad Request.
func Content ¶
Content sends binary safe content.
Compatible with web sockets and server sent events.
func ContentType ¶
ContentType sets the Content-Type header field.
func EventContent ¶
EventContent sends content using the `server sent events` format.
Usually this should be used internally in order to send content to a Server sent event.
That being said, other than the format, there is nothing else different between this function and ResponseSendContent.
See https://html.spec.whatwg.org/multipage/server-sent-events.html for more details on the format.
func Forbiddenf ¶ added in v1.46.0
Forbiddenf sends a message with status 403 Forbidden.
func Header ¶
Header sends a header field.
If the status has not been sent already, a default "200 OK" status will be sent immediately.
This means the status will become locked and further attempts to send the status will fail with an error.
All errors are sent to the server notifier.
func Message ¶
Message sends utf-8 safe content.
Compatible with web sockets and server sent events.
func Messagef ¶
Messagef sends utf-8 safe content using a format.
Compatible with web sockets and server sent events.
func RequestedFile ¶ added in v1.44.2
RequestedFile sends the file requested by the client.
Returns false if connection is web sockets, server sent events or the file was not found.
func SseUpgrade ¶
SseUpgrade upgrades to server sent events and returns a function that sets the name of the current event.
The default event name is "message".
func Status ¶
Status sets the status code.
This will lock the status, which makes it so that the next time you invoke this function it will fail with an error.
All errors are sent to the server notifier.
func TooManyRequests ¶
TooManyRequests sends a message with status 429 Too Many Requests.
func TooManyRequestsf ¶ added in v1.46.0
TooManyRequestsf sends a message with status 403 Forbidden.
func Unauthorized ¶
Unauthorized sends a message with status 401 Unauthorized.
func Unauthorizedf ¶ added in v1.46.0
Unauthorizedf sends a message with status 401 Unauthorized.
Types ¶
This section is empty.
Source Files
¶
- bad_request.go
- bad_requestf.go
- content.go
- content_type.go
- cookie.go
- error.go
- event_content.go
- flush.go
- forbidden.go
- forbiddenf.go
- header.go
- headers.go
- json.go
- message.go
- messagef.go
- navigate.go
- navigatef.go
- not_found.go
- not_foundf.go
- redirect.go
- redirectf.go
- requested_file.go
- sse_upgrade.go
- status.go
- too_many_requests.go
- too_many_requestsf.go
- unauthorized.go
- unauthorizedf.go
- view.go
- ws_upgrade.go
- ws_upgrade_with_upgrader.go