Merge pull request #90 from strukturag/remove-golang-x-net-context

Remove unnecessary dependency golang.org/x/net
This commit is contained in:
Joachim Bauch 2021-04-13 16:39:30 +02:00 committed by GitHub
commit 2c126354a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 5 deletions

View File

@ -36,7 +36,6 @@ import (
"sync"
"github.com/dlintw/goconf"
"golang.org/x/net/context/ctxhttp"
)
var (
@ -248,8 +247,14 @@ func performRequestWithRedirects(ctx context.Context, client *http.Client, req *
req.Body = ioutil.NopCloser(bytes.NewReader(body))
req.ContentLength = int64(len(body))
}
resp, err = ctxhttp.Do(ctx, client, req)
resp, err = client.Do(req.WithContext(ctx))
if err != nil {
// Prefer context error if it has been cancelled.
select {
case <-ctx.Done():
err = ctx.Err()
default:
}
if e, ok := err.(*url.Error); !ok || resp == nil || e.Err != ErrUseLastResponse {
return nil, err
}

1
go.mod
View File

@ -16,6 +16,5 @@ require (
github.com/notedit/janus-go v0.0.0-20200517101215-10eb8b95d1a0
github.com/oschwald/maxminddb-golang v1.3.1-0.20190523235738-1960b16a5147
go.etcd.io/etcd v0.5.0-alpha.5.0.20200824191128-ae9734ed278b
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7
gopkg.in/dgrijalva/jwt-go.v3 v3.2.0
)

View File

@ -22,10 +22,9 @@
package signaling
import (
"context"
"encoding/json"
"testing"
"golang.org/x/net/context"
)
func TestVirtualSession(t *testing.T) {