Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Request ¶
type Request struct { Writer http.ResponseWriter Request *http.Request Response Response Context *RequestContext Session *sessions.Session }
A Request represents a single HTTP request.
func NewRequest ¶
func NewRequest(w http.ResponseWriter, r *http.Request) *Request
func (*Request) SetValue ¶
SetValue sets a request-scoped value with a given key. The value can be retrieved using Value(string)
func (*Request) Write ¶
func (req *Request) Write(w http.ResponseWriter)
Write writes the Response currently stored in the request to the client.
type RequestContext ¶
type RequestContext struct { // ID of the currently logged-in user UserID int32 User *models.Account // The active contest. Generally taken from the hostname -> contest mapping. Contest *models.Contest // Team of the current logged-in user in the active contest. Team *models.Team // Locales as set in Accept-Language Locales []language.Tag }
A RequestContext keeps request-scoped information available during a request.
func (*RequestContext) CanSeeProblem ¶
func (rc *RequestContext) CanSeeProblem(problem *models.Problem) bool
type Response ¶
type Response interface { // The HTTP status code to return. Code() int }
A Response is the return type of a HTTP processor. It represents the response that should be sent back to the client. This is cached since we may have processors that should be run after the main request handler, but before the response is actually sent.
func BadRequest ¶
func Error ¶
Error returns a 500 Internal Server Error Response wrapping the given error. The error message is not displayed, but it is logged internally.