Skip to content
Snippets Groups Projects
Select Git revision
  • renovate/golang.org-x-crypto-0.x
  • renovate/go-1.x
  • renovate/golang.org-x-sync-0.x
  • renovate/opentelemetry-go-monorepo
  • renovate/github.com-go-webauthn-webauthn-0.x
  • renovate/github.com-mattn-go-sqlite3-1.x
  • renovate/github.com-go-ldap-ldap-v3-3.x
  • renovate/github.com-prometheus-client_golang-1.x
  • renovate/github.com-google-go-cmp-0.x
  • master default
  • renovate/github.com-lunixbochs-struc-digest
  • renovate/github.com-duo-labs-webauthn-digest
12 results

backend_test.go

Blame
    • ale's avatar
      54f0ac4c
      Prevent premature cancellation of the HTTP request context · 54f0ac4c
      ale authored
      The Context in the http.Request is bound to the one we give it when
      calling balancedBackend.do(), so we were accessing it out of scope
      when calling the final json.Decode on the response body.
      
      This was not a problem for most *small* requests, as the response Body
      already contains all the data due to having read it along with the
      headers. However, larger response bodies would cause json.Decode to
      call a Read with what at that point is a canceled Context, so the Call
      function would return a mysterious "context canceled" error.
      
      (Note that this change introduces a minor, probably less annoying,
      issue, where we can't reset "resp" between successive calls so we may
      be invoking json.Decode on a non-pristine object if the first call
      fails in some circumstances).
      54f0ac4c
      History
      Prevent premature cancellation of the HTTP request context
      ale authored
      The Context in the http.Request is bound to the one we give it when
      calling balancedBackend.do(), so we were accessing it out of scope
      when calling the final json.Decode on the response body.
      
      This was not a problem for most *small* requests, as the response Body
      already contains all the data due to having read it along with the
      headers. However, larger response bodies would cause json.Decode to
      call a Read with what at that point is a canceled Context, so the Call
      function would return a mysterious "context canceled" error.
      
      (Note that this change introduces a minor, probably less annoying,
      issue, where we can't reset "resp" between successive calls so we may
      be invoking json.Decode on a non-pristine object if the first call
      fails in some circumstances).