github.com/LukasHeimann/cloudfoundrycli@v7.1.0+incompatible/api/cloudcontroller/request.go (about)

     1  package cloudcontroller
     2  
     3  import (
     4  	"io"
     5  	"net/http"
     6  )
     7  
     8  // Request represents the request of the cloud controller.
     9  type Request struct {
    10  	*http.Request
    11  
    12  	body io.ReadSeeker
    13  }
    14  
    15  func (r *Request) ResetBody() error {
    16  	if r.body == nil {
    17  		return nil
    18  	}
    19  
    20  	_, err := r.body.Seek(0, 0)
    21  	return err
    22  }
    23  
    24  func NewRequest(request *http.Request, body io.ReadSeeker) *Request {
    25  	return &Request{
    26  		Request: request,
    27  		body:    body,
    28  	}
    29  }