Skip to content
This repository has been archived by the owner on Jan 14, 2024. It is now read-only.

Commit

Permalink
return fasthttp context as-is
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Ivaykin committed Jun 11, 2020
1 parent d760be4 commit 8b33a4e
Showing 1 changed file with 2 additions and 29 deletions.
31 changes: 2 additions & 29 deletions request.go
Expand Up @@ -3,7 +3,6 @@ package fastjsonrpc
import (
"context"
"encoding/json"
"time"

"github.com/valyala/fasthttp"

Expand All @@ -15,8 +14,6 @@ import (
// RequestHandler must process incoming requests.
type RequestHandler func(ctx *RequestCtx)

var _ context.Context = &RequestCtx{}

// RequestCtx contains incoming request and manages outgoing response.
type RequestCtx struct {
fasthttpCtx *fasthttp.RequestCtx
Expand Down Expand Up @@ -70,30 +67,6 @@ func (ctx *RequestCtx) ParamsUnmarshal(v interface{}) *Error {
return nil
}

// Deadline returns underlying *fasthttp.RequestCtx Deadline.
//
// This method is present to make RequestCtx implement the context interface.
func (ctx *RequestCtx) Deadline() (deadline time.Time, ok bool) {
return ctx.fasthttpCtx.Deadline()
}

// Done returns underlying *fasthttp.RequestCtx Done channel.
//
// This method is present to make RequestCtx implement the context interface.
func (ctx *RequestCtx) Done() <-chan struct{} {
return ctx.fasthttpCtx.Done()
}

// Err returns underlying *fasthttp.RequestCtx Err.
//
// This method is present to make RequestCtx implement the context interface.
func (ctx *RequestCtx) Err() error {
return ctx.fasthttpCtx.Err()
}

// Value returns underlying *fasthttp.RequestCtx Value.
//
// This method is present to make RequestCtx implement the context interface.
func (ctx *RequestCtx) Value(key interface{}) interface{} {
return ctx.fasthttpCtx.Value(key)
func (ctx *RequestCtx) Context() context.Context {
return ctx.fasthttpCtx
}

0 comments on commit 8b33a4e

Please sign in to comment.