-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for issue #2749 - trailing slash request handling
- Loading branch information
1 parent
b263ac7
commit c641873
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package e2e_test | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/go-resty/resty/v2" | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
type RootV3Resource struct { | ||
Links struct { | ||
Self struct { | ||
Href string `json:"href"` | ||
} `json:"self"` | ||
} `json:"links"` | ||
} | ||
|
||
var _ = Describe("RootV3", func() { | ||
var ( | ||
httpResp *resty.Response | ||
requestPath string | ||
) | ||
|
||
BeforeEach(func() { | ||
requestPath = "/v3" | ||
}) | ||
JustBeforeEach(func() { | ||
var err error | ||
httpResp, err = adminClient.R(). | ||
Get(requestPath) | ||
Expect(err).NotTo(HaveOccurred()) | ||
}) | ||
|
||
It("succeeds", func() { | ||
Expect(httpResp).To(HaveRestyStatusCode(http.StatusOK)) | ||
}) | ||
|
||
When("Request ends with a trailing slash", func() { | ||
BeforeEach(func() { | ||
requestPath = "/v3/" | ||
}) | ||
It("succeeds", func() { | ||
Expect(httpResp).To(HaveRestyStatusCode(http.StatusOK)) | ||
}) | ||
}) | ||
}) |