diff --git a/client.go b/client.go index 36f1772..af0cac8 100644 --- a/client.go +++ b/client.go @@ -49,6 +49,13 @@ func (c *Client) Request() *Request { return req } +// Options creates a new OPTIONS request. +func (c *Client) Options() *Request { + req := c.Request() + req.Method("OPTIONS") + return req +} + // Get creates a new GET request. func (c *Client) Get() *Request { req := c.Request() diff --git a/client_test.go b/client_test.go index 0ea765c..8dcb4c8 100644 --- a/client_test.go +++ b/client_test.go @@ -291,4 +291,11 @@ func TestClientVerbMethods(t *testing.T) { if req.Context.Request.Method != "HEAD" { t.Errorf("Invalid request method: %s", req.Context.Request.Method) } + + cli = New() + req = cli.Options() + req.Middleware.Run("request", req.Context) + if req.Context.Request.Method != "OPTIONS" { + t.Errorf("Invalid request method: %s", req.Context.Request.Method) + } }