Fix links

pull/78/head
Fenny 2020-02-08 04:56:57 +01:00
parent 70bb7e1385
commit 62fa147dd1
7 changed files with 65 additions and 67 deletions

View File

@ -71,7 +71,7 @@ type engine struct {
KeepHijackedConns bool KeepHijackedConns bool
} }
// New creates a Fiber instance // New https://fiber.wiki/application#new
func New() *Fiber { func New() *Fiber {
flag.Parse() flag.Parse()
return &Fiber{ return &Fiber{

View File

@ -29,7 +29,7 @@ func (r *Fiber) Shutdown() error {
return r.httpServer.Shutdown() return r.httpServer.Shutdown()
} }
// Listen : https://gofiber.github.io/fiber/#/application?id=listen // Listen : https://fiber.wiki/application#listen
func (r *Fiber) Listen(address interface{}, tls ...string) { func (r *Fiber) Listen(address interface{}, tls ...string) {
host := "" host := ""
switch val := address.(type) { switch val := address.(type) {

View File

@ -19,7 +19,7 @@ import (
"github.com/valyala/fasthttp" "github.com/valyala/fasthttp"
) )
// Accepts : https://gofiber.github.io/fiber/#/context?id=accepts // Accepts : https://fiber.wiki/context#accepts
func (ctx *Ctx) Accepts(offers ...string) string { func (ctx *Ctx) Accepts(offers ...string) string {
if len(offers) == 0 { if len(offers) == 0 {
return "" return ""
@ -57,7 +57,7 @@ func (ctx *Ctx) Accepts(offers ...string) string {
return "" return ""
} }
// AcceptsCharsets : https://gofiber.github.io/fiber/#/context?id=acceptscharsets // AcceptsCharsets : https://fiber.wiki/context#acceptscharsets
func (ctx *Ctx) AcceptsCharsets(offers ...string) string { func (ctx *Ctx) AcceptsCharsets(offers ...string) string {
if len(offers) == 0 { if len(offers) == 0 {
return "" return ""
@ -83,7 +83,7 @@ func (ctx *Ctx) AcceptsCharsets(offers ...string) string {
return "" return ""
} }
// AcceptsEncodings : https://gofiber.github.io/fiber/#/context?id=acceptsencodings // AcceptsEncodings : https://fiber.wiki/context#acceptsencodings
func (ctx *Ctx) AcceptsEncodings(offers ...string) string { func (ctx *Ctx) AcceptsEncodings(offers ...string) string {
if len(offers) == 0 { if len(offers) == 0 {
return "" return ""
@ -109,7 +109,7 @@ func (ctx *Ctx) AcceptsEncodings(offers ...string) string {
return "" return ""
} }
// AcceptsLanguages : https://gofiber.github.io/fiber/#/context?id=acceptslanguages // AcceptsLanguages : https://fiber.wiki/context#acceptslanguages
func (ctx *Ctx) AcceptsLanguages(offers ...string) string { func (ctx *Ctx) AcceptsLanguages(offers ...string) string {
if len(offers) == 0 { if len(offers) == 0 {
return "" return ""
@ -134,18 +134,18 @@ func (ctx *Ctx) AcceptsLanguages(offers ...string) string {
return "" return ""
} }
// BaseUrl : https://gofiber.github.io/fiber/#/context?id=baseurl // BaseUrl : https://fiber.wiki/context#baseurl
func (ctx *Ctx) BaseUrl() string { func (ctx *Ctx) BaseUrl() string {
fmt.Println("Fiber deprecated c.BaseUrl(), this will be removed in v2: Use c.BaseURL() instead") fmt.Println("Fiber deprecated c.BaseUrl(), this will be removed in v2: Use c.BaseURL() instead")
return ctx.BaseURL() return ctx.BaseURL()
} }
// BaseURL : https://gofiber.github.io/fiber/#/context?id=baseurl // BaseURL : https://fiber.wiki/context#baseurl
func (ctx *Ctx) BaseURL() string { func (ctx *Ctx) BaseURL() string {
return ctx.Protocol() + "://" + ctx.Hostname() return ctx.Protocol() + "://" + ctx.Hostname()
} }
// BasicAuth : https://gofiber.github.io/fiber/#/context?id=basicauth // BasicAuth : https://fiber.wiki/context#basicauth
func (ctx *Ctx) BasicAuth() (user, pass string, ok bool) { func (ctx *Ctx) BasicAuth() (user, pass string, ok bool) {
auth := ctx.Get(fasthttp.HeaderAuthorization) auth := ctx.Get(fasthttp.HeaderAuthorization)
if auth == "" { if auth == "" {
@ -173,7 +173,7 @@ func (ctx *Ctx) BasicAuth() (user, pass string, ok bool) {
return cs[:s], cs[s+1:], true return cs[:s], cs[s+1:], true
} }
// Body : https://gofiber.github.io/fiber/#/context?id=body // Body : https://fiber.wiki/context#body
func (ctx *Ctx) Body(args ...interface{}) string { func (ctx *Ctx) Body(args ...interface{}) string {
if len(args) == 0 { if len(args) == 0 {
return getString(ctx.Fasthttp.Request.Body()) return getString(ctx.Fasthttp.Request.Body())
@ -196,7 +196,7 @@ func (ctx *Ctx) Body(args ...interface{}) string {
return "" return ""
} }
// BodyParser : https://gofiber.github.io/fiber/#/context?id=bodyparser // BodyParser : https://fiber.wiki/context#bodyparser
func (ctx *Ctx) BodyParser(v interface{}) error { func (ctx *Ctx) BodyParser(v interface{}) error {
cType := getString(ctx.Fasthttp.Request.Header.ContentType()) cType := getString(ctx.Fasthttp.Request.Header.ContentType())
if cType == contentTypeJSON { if cType == contentTypeJSON {
@ -207,7 +207,7 @@ func (ctx *Ctx) BodyParser(v interface{}) error {
return fmt.Errorf("Cannot parse Content-Type: %v", cType) return fmt.Errorf("Cannot parse Content-Type: %v", cType)
} }
// Cookies : https://gofiber.github.io/fiber/#/context?id=cookies // Cookies : https://fiber.wiki/context#cookies
func (ctx *Ctx) Cookies(args ...interface{}) string { func (ctx *Ctx) Cookies(args ...interface{}) string {
if len(args) == 0 { if len(args) == 0 {
return ctx.Get(fasthttp.HeaderCookie) return ctx.Get(fasthttp.HeaderCookie)
@ -229,22 +229,22 @@ func (ctx *Ctx) Cookies(args ...interface{}) string {
return "" return ""
} }
// FormFile : https://gofiber.github.io/fiber/#/context?id=formfile // FormFile : https://fiber.wiki/context#formfile
func (ctx *Ctx) FormFile(key string) (*multipart.FileHeader, error) { func (ctx *Ctx) FormFile(key string) (*multipart.FileHeader, error) {
return ctx.Fasthttp.FormFile(key) return ctx.Fasthttp.FormFile(key)
} }
// FormValue : https://gofiber.github.io/fiber/#/context?id=formvalue // FormValue : https://fiber.wiki/context#formvalue
func (ctx *Ctx) FormValue(key string) string { func (ctx *Ctx) FormValue(key string) string {
return getString(ctx.Fasthttp.FormValue(key)) return getString(ctx.Fasthttp.FormValue(key))
} }
// Fresh : https://gofiber.github.io/fiber/#/context?id=fresh // Fresh : https://fiber.wiki/context#fresh
func (ctx *Ctx) Fresh() bool { func (ctx *Ctx) Fresh() bool {
return true return true
} }
// Get : https://gofiber.github.io/fiber/#/context?id=get // Get : https://fiber.wiki/context#get
func (ctx *Ctx) Get(key string) string { func (ctx *Ctx) Get(key string) string {
if key == "referrer" { if key == "referrer" {
key = "referer" key = "referer"
@ -252,7 +252,7 @@ func (ctx *Ctx) Get(key string) string {
return getString(ctx.Fasthttp.Request.Header.Peek(key)) return getString(ctx.Fasthttp.Request.Header.Peek(key))
} }
// Hostname : https://gofiber.github.io/fiber/#/context?id=hostname // Hostname : https://fiber.wiki/context#hostname
func (ctx *Ctx) Hostname() string { func (ctx *Ctx) Hostname() string {
return getString(ctx.Fasthttp.URI().Host()) return getString(ctx.Fasthttp.URI().Host())
} }
@ -263,7 +263,7 @@ func (ctx *Ctx) Ip() string {
return ctx.IP() return ctx.IP()
} }
// IP : https://gofiber.github.io/fiber/#/context?id=Ip // IP : https://fiber.wiki/context#Ip
func (ctx *Ctx) IP() string { func (ctx *Ctx) IP() string {
return ctx.Fasthttp.RemoteIP().String() return ctx.Fasthttp.RemoteIP().String()
} }
@ -274,7 +274,7 @@ func (ctx *Ctx) Ips() []string { // NOLINT
return ctx.IPs() return ctx.IPs()
} }
// IPs : https://gofiber.github.io/fiber/#/context?id=ips // IPs : https://fiber.wiki/context#ips
func (ctx *Ctx) IPs() []string { func (ctx *Ctx) IPs() []string {
ips := strings.Split(ctx.Get(fasthttp.HeaderXForwardedFor), ",") ips := strings.Split(ctx.Get(fasthttp.HeaderXForwardedFor), ",")
for i := range ips { for i := range ips {
@ -283,7 +283,7 @@ func (ctx *Ctx) IPs() []string {
return ips return ips
} }
// Is : https://gofiber.github.io/fiber/#/context?id=is // Is : https://fiber.wiki/context#is
func (ctx *Ctx) Is(ext string) bool { func (ctx *Ctx) Is(ext string) bool {
if ext[0] != '.' { if ext[0] != '.' {
ext = "." + ext ext = "." + ext
@ -300,7 +300,7 @@ func (ctx *Ctx) Is(ext string) bool {
return false return false
} }
// Locals : https://gofiber.github.io/fiber/#/context?id=locals // Locals : https://fiber.wiki/context#locals
func (ctx *Ctx) Locals(key string, val ...interface{}) interface{} { func (ctx *Ctx) Locals(key string, val ...interface{}) interface{} {
if len(val) == 0 { if len(val) == 0 {
return ctx.Fasthttp.UserValue(key) return ctx.Fasthttp.UserValue(key)
@ -310,12 +310,12 @@ func (ctx *Ctx) Locals(key string, val ...interface{}) interface{} {
return nil return nil
} }
// Method : https://gofiber.github.io/fiber/#/context?id=method // Method : https://fiber.wiki/context#method
func (ctx *Ctx) Method() string { func (ctx *Ctx) Method() string {
return getString(ctx.Fasthttp.Request.Header.Method()) return getString(ctx.Fasthttp.Request.Header.Method())
} }
// MultipartForm : https://gofiber.github.io/fiber/#/context?id=multipartform // MultipartForm : https://fiber.wiki/context#multipartform
func (ctx *Ctx) MultipartForm() (*multipart.Form, error) { func (ctx *Ctx) MultipartForm() (*multipart.Form, error) {
return ctx.Fasthttp.MultipartForm() return ctx.Fasthttp.MultipartForm()
} }
@ -326,12 +326,12 @@ func (ctx *Ctx) OriginalUrl() string {
return ctx.OriginalURL() return ctx.OriginalURL()
} }
// OriginalURL : https://gofiber.github.io/fiber/#/context?id=originalurl // OriginalURL : https://fiber.wiki/context#originalurl
func (ctx *Ctx) OriginalURL() string { func (ctx *Ctx) OriginalURL() string {
return getString(ctx.Fasthttp.Request.Header.RequestURI()) return getString(ctx.Fasthttp.Request.Header.RequestURI())
} }
// Params : https://gofiber.github.io/fiber/#/context?id=params // Params : https://fiber.wiki/context#params
func (ctx *Ctx) Params(key string) string { func (ctx *Ctx) Params(key string) string {
for i := 0; i < len(*ctx.params); i++ { for i := 0; i < len(*ctx.params); i++ {
if (*ctx.params)[i] == key { if (*ctx.params)[i] == key {
@ -341,12 +341,12 @@ func (ctx *Ctx) Params(key string) string {
return "" return ""
} }
// Path : https://gofiber.github.io/fiber/#/context?id=path // Path : https://fiber.wiki/context#path
func (ctx *Ctx) Path() string { func (ctx *Ctx) Path() string {
return getString(ctx.Fasthttp.URI().Path()) return getString(ctx.Fasthttp.URI().Path())
} }
// Protocol : https://gofiber.github.io/fiber/#/context?id=protocol // Protocol : https://fiber.wiki/context#protocol
func (ctx *Ctx) Protocol() string { func (ctx *Ctx) Protocol() string {
if ctx.Fasthttp.IsTLS() { if ctx.Fasthttp.IsTLS() {
return "https" return "https"
@ -354,42 +354,42 @@ func (ctx *Ctx) Protocol() string {
return "http" return "http"
} }
// Query : https://gofiber.github.io/fiber/#/context?id=query // Query : https://fiber.wiki/context#query
func (ctx *Ctx) Query(key string) string { func (ctx *Ctx) Query(key string) string {
return getString(ctx.Fasthttp.QueryArgs().Peek(key)) return getString(ctx.Fasthttp.QueryArgs().Peek(key))
} }
// Range : https://gofiber.github.io/fiber/#/context?id=range // Range : https://fiber.wiki/context#range
func (ctx *Ctx) Range() { func (ctx *Ctx) Range() {
} }
// Route : https://gofiber.github.io/fiber/#/context?id=route // Route : https://fiber.wiki/context#route
func (ctx *Ctx) Route() *Route { func (ctx *Ctx) Route() *Route {
return ctx.route return ctx.route
} }
// SaveFile : https://gofiber.github.io/fiber/#/context?id=secure // SaveFile : https://fiber.wiki/context#secure
func (ctx *Ctx) SaveFile(fh *multipart.FileHeader, path string) error { func (ctx *Ctx) SaveFile(fh *multipart.FileHeader, path string) error {
return fasthttp.SaveMultipartFile(fh, path) return fasthttp.SaveMultipartFile(fh, path)
} }
// Secure : https://gofiber.github.io/fiber/#/context?id=secure // Secure : https://fiber.wiki/context#secure
func (ctx *Ctx) Secure() bool { func (ctx *Ctx) Secure() bool {
return ctx.Fasthttp.IsTLS() return ctx.Fasthttp.IsTLS()
} }
// SignedCookies : https://gofiber.github.io/fiber/#/context?id=signedcookies // SignedCookies : https://fiber.wiki/context#signedcookies
func (ctx *Ctx) SignedCookies() { func (ctx *Ctx) SignedCookies() {
} }
// Stale : https://gofiber.github.io/fiber/#/context?id=stale // Stale : https://fiber.wiki/context#stale
func (ctx *Ctx) Stale() bool { func (ctx *Ctx) Stale() bool {
return true return true
} }
// Subdomains : https://gofiber.github.io/fiber/#/context?id=subdomains // Subdomains : https://fiber.wiki/context#subdomains
func (ctx *Ctx) Subdomains(offset ...int) (subs []string) { func (ctx *Ctx) Subdomains(offset ...int) (subs []string) {
o := 2 o := 2
if len(offset) > 0 { if len(offset) > 0 {
@ -406,7 +406,7 @@ func (ctx *Ctx) Xhr() bool {
return ctx.XHR() return ctx.XHR()
} }
// XHR : https://gofiber.github.io/fiber/#/context?id=xhr // XHR : https://fiber.wiki/context#xhr
func (ctx *Ctx) XHR() bool { func (ctx *Ctx) XHR() bool {
return ctx.Get(fasthttp.HeaderXRequestedWith) == "XMLHttpRequest" return ctx.Get(fasthttp.HeaderXRequestedWith) == "XMLHttpRequest"
} }

View File

@ -19,7 +19,7 @@ import (
"github.com/valyala/fasthttp" "github.com/valyala/fasthttp"
) )
// Append : https://gofiber.github.io/fiber/#/context?id=append // Append : https://fiber.wiki/context#append
func (ctx *Ctx) Append(field string, values ...string) { func (ctx *Ctx) Append(field string, values ...string) {
if len(values) == 0 { if len(values) == 0 {
return return
@ -35,7 +35,7 @@ func (ctx *Ctx) Append(field string, values ...string) {
ctx.Set(field, h) ctx.Set(field, h)
} }
// Attachment : https://gofiber.github.io/fiber/#/context?id=attachment // Attachment : https://fiber.wiki/context#attachment
func (ctx *Ctx) Attachment(name ...string) { func (ctx *Ctx) Attachment(name ...string) {
if len(name) > 0 { if len(name) > 0 {
filename := filepath.Base(name[0]) filename := filepath.Base(name[0])
@ -46,7 +46,7 @@ func (ctx *Ctx) Attachment(name ...string) {
ctx.Set(fasthttp.HeaderContentDisposition, "attachment") ctx.Set(fasthttp.HeaderContentDisposition, "attachment")
} }
// ClearCookie : https://gofiber.github.io/fiber/#/context?id=clearcookie // ClearCookie : https://fiber.wiki/context#clearcookie
func (ctx *Ctx) ClearCookie(name ...string) { func (ctx *Ctx) ClearCookie(name ...string) {
if len(name) > 0 { if len(name) > 0 {
for i := range name { for i := range name {
@ -61,7 +61,7 @@ func (ctx *Ctx) ClearCookie(name ...string) {
}) })
} }
// Cookie : https://gofiber.github.io/fiber/#/context?id=cookie // Cookie : https://fiber.wiki/context#cookie
func (ctx *Ctx) Cookie(key, value string, options ...interface{}) { func (ctx *Ctx) Cookie(key, value string, options ...interface{}) {
cook := &fasthttp.Cookie{} cook := &fasthttp.Cookie{}
@ -111,7 +111,7 @@ func (ctx *Ctx) Cookie(key, value string, options ...interface{}) {
ctx.Fasthttp.Response.Header.SetCookie(cook) ctx.Fasthttp.Response.Header.SetCookie(cook)
} }
// Download : https://gofiber.github.io/fiber/#/context?id=download // Download : https://fiber.wiki/context#download
func (ctx *Ctx) Download(file string, name ...string) { func (ctx *Ctx) Download(file string, name ...string) {
filename := filepath.Base(file) filename := filepath.Base(file)
@ -123,12 +123,12 @@ func (ctx *Ctx) Download(file string, name ...string) {
ctx.SendFile(file) ctx.SendFile(file)
} }
// End : https://gofiber.github.io/fiber/#/context?id=end // End : https://fiber.wiki/context#end
func (ctx *Ctx) End() { func (ctx *Ctx) End() {
} }
// Format : https://gofiber.github.io/fiber/#/context?id=format // Format : https://fiber.wiki/context#format
func (ctx *Ctx) Format(args ...interface{}) { func (ctx *Ctx) Format(args ...interface{}) {
var body string var body string
@ -156,7 +156,7 @@ func (ctx *Ctx) Format(args ...interface{}) {
} }
} }
// HeadersSent : https://gofiber.github.io/fiber/#/context?id=headerssent // HeadersSent : https://fiber.wiki/context#headerssent
func (ctx *Ctx) HeadersSent() { func (ctx *Ctx) HeadersSent() {
} }
@ -167,7 +167,7 @@ func (ctx *Ctx) Json(v interface{}) error {
return ctx.JSON(v) return ctx.JSON(v)
} }
// JSON : https://gofiber.github.io/fiber/#/context?id=json // JSON : https://fiber.wiki/context#json
func (ctx *Ctx) JSON(v interface{}) error { func (ctx *Ctx) JSON(v interface{}) error {
raw, err := jsoniter.Marshal(&v) raw, err := jsoniter.Marshal(&v)
if err != nil { if err != nil {
@ -186,7 +186,7 @@ func (ctx *Ctx) JsonBytes(raw []byte) {
ctx.JSONBytes(raw) ctx.JSONBytes(raw)
} }
// JSONBytes : https://gofiber.github.io/fiber/#/context?id=jsonbytes // JSONBytes : https://fiber.wiki/context#jsonbytes
func (ctx *Ctx) JSONBytes(raw []byte) { func (ctx *Ctx) JSONBytes(raw []byte) {
ctx.Fasthttp.Response.Header.SetContentType(contentTypeJSON) ctx.Fasthttp.Response.Header.SetContentType(contentTypeJSON)
ctx.Fasthttp.Response.SetBodyString(getString(raw)) ctx.Fasthttp.Response.SetBodyString(getString(raw))
@ -198,7 +198,7 @@ func (ctx *Ctx) Jsonp(v interface{}, cb ...string) error {
return ctx.JSONP(v, cb...) return ctx.JSONP(v, cb...)
} }
// JSONP : https://gofiber.github.io/fiber/#/context?id=jsonp // JSONP : https://fiber.wiki/context#jsonp
func (ctx *Ctx) JSONP(v interface{}, cb ...string) error { func (ctx *Ctx) JSONP(v interface{}, cb ...string) error {
raw, err := jsoniter.Marshal(&v) raw, err := jsoniter.Marshal(&v)
if err != nil { if err != nil {
@ -224,13 +224,13 @@ func (ctx *Ctx) JsonString(raw string) {
ctx.JSONString(raw) ctx.JSONString(raw)
} }
// JSONString : https://gofiber.github.io/fiber/#/context?id=jsonstring // JSONString : https://fiber.wiki/context#jsonstring
func (ctx *Ctx) JSONString(raw string) { func (ctx *Ctx) JSONString(raw string) {
ctx.Fasthttp.Response.Header.SetContentType(contentTypeJSON) ctx.Fasthttp.Response.Header.SetContentType(contentTypeJSON)
ctx.Fasthttp.Response.SetBodyString(raw) ctx.Fasthttp.Response.SetBodyString(raw)
} }
// Links : https://gofiber.github.io/fiber/#/context?id=links // Links : https://fiber.wiki/context#links
func (ctx *Ctx) Links(link ...string) { func (ctx *Ctx) Links(link ...string) {
h := "" h := ""
for i, l := range link { for i, l := range link {
@ -247,12 +247,12 @@ func (ctx *Ctx) Links(link ...string) {
} }
} }
// Location : https://gofiber.github.io/fiber/#/context?id=location // Location : https://fiber.wiki/context#location
func (ctx *Ctx) Location(path string) { func (ctx *Ctx) Location(path string) {
ctx.Set(fasthttp.HeaderLocation, path) ctx.Set(fasthttp.HeaderLocation, path)
} }
// Next : https://gofiber.github.io/fiber/#/context?id=next // Next : https://fiber.wiki/context#next
func (ctx *Ctx) Next() { func (ctx *Ctx) Next() {
ctx.route = nil ctx.route = nil
ctx.next = true ctx.next = true
@ -260,7 +260,7 @@ func (ctx *Ctx) Next() {
ctx.values = nil ctx.values = nil
} }
// Redirect : https://gofiber.github.io/fiber/#/context?id=redirect // Redirect : https://fiber.wiki/context#redirect
func (ctx *Ctx) Redirect(path string, status ...int) { func (ctx *Ctx) Redirect(path string, status ...int) {
code := 302 code := 302
if len(status) > 0 { if len(status) > 0 {
@ -271,12 +271,12 @@ func (ctx *Ctx) Redirect(path string, status ...int) {
ctx.Fasthttp.Response.SetStatusCode(code) ctx.Fasthttp.Response.SetStatusCode(code)
} }
// Render : https://gofiber.github.io/fiber/#/context?id=render // Render : https://fiber.wiki/context#render
func (ctx *Ctx) Render() { func (ctx *Ctx) Render() {
} }
// Send : https://gofiber.github.io/fiber/#/context?id=send // Send : https://fiber.wiki/context#send
func (ctx *Ctx) Send(args ...interface{}) { func (ctx *Ctx) Send(args ...interface{}) {
if len(args) == 0 { if len(args) == 0 {
return return
@ -292,12 +292,12 @@ func (ctx *Ctx) Send(args ...interface{}) {
} }
} }
// SendBytes : https://gofiber.github.io/fiber/#/context?id=sendbytes // SendBytes : https://fiber.wiki/context#sendbytes
func (ctx *Ctx) SendBytes(body []byte) { func (ctx *Ctx) SendBytes(body []byte) {
ctx.Fasthttp.Response.SetBodyString(getString(body)) ctx.Fasthttp.Response.SetBodyString(getString(body))
} }
// SendFile : https://gofiber.github.io/fiber/#/context?id=sendfile // SendFile : https://fiber.wiki/context#sendfile
func (ctx *Ctx) SendFile(file string, gzip ...bool) { func (ctx *Ctx) SendFile(file string, gzip ...bool) {
// Disable gzipping // Disable gzipping
if len(gzip) > 0 && !gzip[0] { if len(gzip) > 0 && !gzip[0] {
@ -311,7 +311,7 @@ func (ctx *Ctx) SendFile(file string, gzip ...bool) {
//ctx.Fasthttp.SendFile(path) //ctx.Fasthttp.SendFile(path)
} }
// SendStatus : https://gofiber.github.io/fiber/#/context?id=sendstatus // SendStatus : https://fiber.wiki/context#sendstatus
func (ctx *Ctx) SendStatus(status int) { func (ctx *Ctx) SendStatus(status int) {
ctx.Fasthttp.Response.SetStatusCode(status) ctx.Fasthttp.Response.SetStatusCode(status)
@ -324,29 +324,29 @@ func (ctx *Ctx) SendStatus(status int) {
} }
} }
// SendString : https://gofiber.github.io/fiber/#/context?id=sendstring // SendString : https://fiber.wiki/context#sendstring
func (ctx *Ctx) SendString(body string) { func (ctx *Ctx) SendString(body string) {
ctx.Fasthttp.Response.SetBodyString(body) ctx.Fasthttp.Response.SetBodyString(body)
} }
// Set : https://gofiber.github.io/fiber/#/context?id=set // Set : https://fiber.wiki/context#set
func (ctx *Ctx) Set(key string, val string) { func (ctx *Ctx) Set(key string, val string) {
ctx.Fasthttp.Response.Header.SetCanonical(getBytes(key), getBytes(val)) ctx.Fasthttp.Response.Header.SetCanonical(getBytes(key), getBytes(val))
} }
// Status : https://gofiber.github.io/fiber/#/context?id=status // Status : https://fiber.wiki/context#status
func (ctx *Ctx) Status(status int) *Ctx { func (ctx *Ctx) Status(status int) *Ctx {
ctx.Fasthttp.Response.SetStatusCode(status) ctx.Fasthttp.Response.SetStatusCode(status)
return ctx return ctx
} }
// Type : https://gofiber.github.io/fiber/#/context?id=type // Type : https://fiber.wiki/context#type
func (ctx *Ctx) Type(ext string) *Ctx { func (ctx *Ctx) Type(ext string) *Ctx {
ctx.Fasthttp.Response.Header.SetContentType(getType(ext)) ctx.Fasthttp.Response.Header.SetContentType(getType(ext))
return ctx return ctx
} }
// Vary : https://gofiber.github.io/fiber/#/context?id=vary // Vary : https://fiber.wiki/context#vary
func (ctx *Ctx) Vary(fields ...string) { func (ctx *Ctx) Vary(fields ...string) {
if len(fields) == 0 { if len(fields) == 0 {
return return
@ -364,7 +364,7 @@ func (ctx *Ctx) Vary(fields ...string) {
ctx.Set(fasthttp.HeaderVary, h) ctx.Set(fasthttp.HeaderVary, h)
} }
// Write : https://gofiber.github.io/fiber/#/context?id=write // Write : https://fiber.wiki/context#write
func (ctx *Ctx) Write(args ...interface{}) { func (ctx *Ctx) Write(args ...interface{}) {
for i := range args { for i := range args {
switch body := args[i].(type) { switch body := args[i].(type) {
@ -384,7 +384,7 @@ func (ctx *Ctx) Xml(v interface{}) error {
return ctx.XML(v) return ctx.XML(v)
} }
// XML : https://gofiber.github.io/fiber/#/context?id=xml // XML : https://fiber.wiki/context#xml
func (ctx *Ctx) XML(v interface{}) error { func (ctx *Ctx) XML(v interface{}) error {
raw, err := xml.Marshal(v) raw, err := xml.Marshal(v)
if err != nil { if err != nil {

View File

@ -14,7 +14,7 @@ import (
"strings" "strings"
) )
// Static https://gofiber.github.io/fiber/#/application?id=static // Static https://fiber.wiki/application#static
func (r *Fiber) Static(args ...string) { func (r *Fiber) Static(args ...string) {
prefix := "/" prefix := "/"
root := "./" root := "./"

View File

@ -7,7 +7,6 @@
package fiber package fiber
// statusMessages https://gofiber.github.io/fiber/#/context?id=sendstatus
var statusMessages = map[int]string{ var statusMessages = map[int]string{
100: "Continue", 100: "Continue",
101: "Switching Protocols", 101: "Switching Protocols",

View File

@ -7,7 +7,6 @@
package fiber package fiber
// common content types
const ( const (
contentTypeJSON = "application/json" contentTypeJSON = "application/json"
contentTypeJs = "application/javascript" contentTypeJs = "application/javascript"