File: context_go17.go

package info (click to toggle)
golang-gopkg-httprequest.v1 0.0~git20171212.fdaf1bf-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 316 kB
  • sloc: makefile: 4
file content (19 lines) | stat: -rw-r--r-- 397 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Copyright 2016 Canonical Ltd.
// Licensed under the LGPLv3, see LICENCE file for details.

// +build go1.7

package httprequest

import (
	"context"
	"net/http"
)

func contextFromRequest(req *http.Request) (context.Context, context.CancelFunc) {
	return req.Context(), func() {}
}

func requestWithContext(req *http.Request, ctx context.Context) *http.Request {
	return req.WithContext(ctx)
}