route

package
v0.0.0-...-c0cdbda Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2023 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapedPath

func EscapedPath(next http.Handler) http.Handler

EscapedPath is a middleware that sets the route path to the escaped URL path rather than the decoded one. It "fixes" chi mistreating escaped characters like '%2F' as '/' which causes routing problems.

Types

type RouteContext

type RouteContext struct {
	Config *config.Config
}

RouteContext stores the necessary things for handling requests.

func NewRouteContext

func NewRouteContext(cfg *config.Config) (*RouteContext, error)

NewRouteContext returns a new RouteContext.

func (*RouteContext) Commit

func (c *RouteContext) Commit(w http.ResponseWriter, r *http.Request)

Commit displays the message and textual diff of a commit.

func (*RouteContext) Error

func (c *RouteContext) Error(w http.ResponseWriter, code int)

Error writes an HTML error page with the given HTTP status code.

func (*RouteContext) GitInfoRefs

func (c *RouteContext) GitInfoRefs(w http.ResponseWriter, r *http.Request)

GitInfoRefs sends the list of remote references in a repository.

func (*RouteContext) GitUploadPack

func (c *RouteContext) GitUploadPack(w http.ResponseWriter, r *http.Request)

GitUploadPack sends a packfile containing the missing git objects that were requested by the client.

func (*RouteContext) Handler

func (c *RouteContext) Handler() http.Handler

Handler returns an http.Handler using the receiving context.

func (*RouteContext) Index

func (c *RouteContext) Index(w http.ResponseWriter, _ *http.Request)

Index lists all repositories under the configuration's repository directory.

func (*RouteContext) InternalServerError

func (c *RouteContext) InternalServerError(w http.ResponseWriter)

InternalServerError calls c.Error with status code 500.

func (*RouteContext) Log

Log displays the commit history of a reference, tree, or blob.

func (*RouteContext) NotFound

func (c *RouteContext) NotFound(w http.ResponseWriter)

NotFound calls c.Error with status code 404.

func (*RouteContext) Patch

func (c *RouteContext) Patch(w http.ResponseWriter, r *http.Request)

Patch displays the patch set for a commit in plain text.

func (*RouteContext) Raw

Raw displays the content of a file in plain text.

func (*RouteContext) Refs

func (c *RouteContext) Refs(w http.ResponseWriter, r *http.Request)

Refs lists all tags and branches in a repository.

func (*RouteContext) Render

func (c *RouteContext) Render(name string, w http.ResponseWriter, code int, data any)

Render renders the given data with to w with the given HTTP status code. If an error occurs, it responses with the internal server error message.

func (*RouteContext) Summary

func (c *RouteContext) Summary(w http.ResponseWriter, r *http.Request)

Summary displays the general information of a repository.

func (*RouteContext) Tag

Tag displays the information of an annotated tag.

func (*RouteContext) Tree

func (c *RouteContext) Tree(w http.ResponseWriter, r *http.Request)

Tree displays a tree or a blob object from a reference.

func (*RouteContext) WriteText

func (c *RouteContext) WriteText(w http.ResponseWriter, code int, data []byte)

WriteText writes the given data to w with the text/plain media type.

Jump to

Keyboard shortcuts

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