From 6db1946298c5ca2fd72ba97e344aad5b0ffc993f Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Thu, 10 Dec 2015 13:17:21 +0200 Subject: [PATCH] Use ctx.UserAgent() shortcut instead of ctx.Request.Header.UserAgent() --- README.md | 2 +- examples/helloworldserver/helloworldserver.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b1e17bd..2bbfbd4 100644 --- a/README.md +++ b/README.md @@ -289,7 +289,7 @@ fastttp.ListenAndServe(":80", m) * r.TLS -> [ctx.IsTLS()](https://godoc.org/github.com/valyala/fasthttp#RequestCtx.IsTLS) * r.Cookie() -> [ctx.Request.Header.Cookie()](https://godoc.org/github.com/valyala/fasthttp#RequestHeader.Cookie) * r.Referer() -> [ctx.Referer()](https://godoc.org/github.com/valyala/fasthttp#RequestCtx.Referer) - * r.UserAgent() -> [ctx.Request.Header.UserAgent()](https://godoc.org/github.com/valyala/fasthttp#RequestHeader.UserAgent) + * r.UserAgent() -> [ctx.UserAgent()](https://godoc.org/github.com/valyala/fasthttp#RequestCtx.UserAgent) * w.Header() -> [ctx.Response.Header](https://godoc.org/github.com/valyala/fasthttp#ResponseHeader) * w.Header().Set() -> [ctx.Response.Header.Set()](https://godoc.org/github.com/valyala/fasthttp#ResponseHeader.Set) * w.Header().Set("Content-Type") -> [ctx.SetContentType()](https://godoc.org/github.com/valyala/fasthttp#RequestCtx.SetContentType) diff --git a/examples/helloworldserver/helloworldserver.go b/examples/helloworldserver/helloworldserver.go index cd10253..f4c9c3e 100644 --- a/examples/helloworldserver/helloworldserver.go +++ b/examples/helloworldserver/helloworldserver.go @@ -26,7 +26,7 @@ func requestHandler(ctx *fasthttp.RequestCtx) { fmt.Fprintf(ctx, "Requested path is %q\n", ctx.Path()) fmt.Fprintf(ctx, "Host is %q\n", ctx.Host()) fmt.Fprintf(ctx, "Query string is %q\n", ctx.QueryArgs()) - fmt.Fprintf(ctx, "User-Agent is %q\n", ctx.Request.Header.UserAgent()) + fmt.Fprintf(ctx, "User-Agent is %q\n", ctx.UserAgent()) fmt.Fprintf(ctx, "Connection has been established at %s\n", ctx.ConnTime()) fmt.Fprintf(ctx, "Request has been started at %s\n", ctx.Time()) fmt.Fprintf(ctx, "Serial request number for the current connection is %d\n", ctx.ConnRequestNum())