github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/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  }