Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow pre-release cli versions #3255

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/middleware/cli_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/mileusna/useragent"
)

const minSupportedVersion = ">= 8.5.0"
const minSupportedVersion = ">= 8.5.0-0"

func CFCliVersion(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
Expand Down
10 changes: 10 additions & 0 deletions api/middleware/cli_version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ var _ = Describe("CliVersionMiddleware", func() {
})
})

When("the cf cli version is a valid pre-release", func() {
BeforeEach(func() {
requestHeaders["User-Agent"] = []string{"cf/9.0.0-beta+334489f01.2024-05-14 (go1.22.2; arm64 darwin)"}
})

It("delegates to the next handler", func() {
Expect(rr).To(HaveHTTPStatus(http.StatusTeapot))
})
})

When("there are multiple UserAgent header values", func() {
BeforeEach(func() {
requestHeaders["User-Agent"] = []string{
Expand Down