Skip to content
This repository has been archived by the owner on Feb 12, 2025. It is now read-only.

Commit

Permalink
adding a new preparer for MERGE used in the Storage API's (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
tombuildsstuff authored and jhendrixMSFT committed Jun 19, 2019
1 parent 98c2976 commit ae1b5cf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions autorest/preparer.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ func AsGet() PrepareDecorator { return WithMethod("GET") }
// AsHead returns a PrepareDecorator that sets the HTTP method to HEAD.
func AsHead() PrepareDecorator { return WithMethod("HEAD") }

// AsMerge returns a PrepareDecorator that sets the HTTP method to MERGE.
func AsMerge() PrepareDecorator { return WithMethod("MERGE") }

// AsOptions returns a PrepareDecorator that sets the HTTP method to OPTIONS.
func AsOptions() PrepareDecorator { return WithMethod("OPTIONS") }

Expand Down
7 changes: 7 additions & 0 deletions autorest/preparer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,13 @@ func TestAsHead(t *testing.T) {
}
}

func TestAsMerge(t *testing.T) {
r, _ := Prepare(mocks.NewRequest(), AsMerge())
if r.Method != "MERGE" {
t.Fatal("autorest: AsMerge failed to set HTTP method header to MERGE")
}
}

func TestAsOptions(t *testing.T) {
r, _ := Prepare(mocks.NewRequest(), AsOptions())
if r.Method != "OPTIONS" {
Expand Down

0 comments on commit ae1b5cf

Please sign in to comment.