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

Commit

Permalink
Close request body so connections aren't leaked
Browse files Browse the repository at this point in the history
  • Loading branch information
nemosupremo committed Sep 18, 2018
1 parent 389484f commit 6d52033
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gatekeeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ func (g *Gatekeeper) GetRoleId(roleName string, authToken string) (string, error
RedirectHeaders: true,
}.WithHeader("X-Vault-Token", authToken)}.Do()
if err == nil {
defer r.Body.Close()
switch r.StatusCode {
case 200:
var resp struct {
Expand Down Expand Up @@ -394,6 +395,7 @@ func (g *Gatekeeper) GetSecretId(roleName string, authToken string) (string, err
Method: "POST",
}.WithHeader("X-Vault-Token", authToken)}.Do()
if err == nil {
defer r.Body.Close()
switch r.StatusCode {
case 200:
var resp struct {
Expand Down Expand Up @@ -607,6 +609,7 @@ func (g *Gatekeeper) TokenTtl() (time.Duration, error) {
Method: "GET",
}.WithHeader("X-Vault-Token", token)}.Do()
if err == nil {
defer r.Body.Close()
switch r.StatusCode {
case 200:
var resp struct {
Expand Down Expand Up @@ -648,6 +651,7 @@ func (g *Gatekeeper) RenewToken() error {
Method: "POST",
}.WithHeader("X-Vault-Token", token)}.Do()
if err == nil {
defer r.Body.Close()
switch r.StatusCode {
case 200, 204:
return nil
Expand Down

0 comments on commit 6d52033

Please sign in to comment.