add: new Bearer Auth undefined test case and update Authorization header format

This commit is contained in:
sanish-bruno
2025-06-13 14:42:57 +05:30
parent a598cda624
commit 66fe1528df
2 changed files with 28 additions and 1 deletions

View File

@@ -0,0 +1,27 @@
meta {
name: Bearer Auth undefined
type: http
seq: 2
}
get {
url: {{host}}/api/auth/bearer/protected
body: none
auth: bearer
}
headers {
Authorization: Bearer {{bearer_auth_token}}
}
assert {
res.body.message: eq Unauthorized
res.status: eq 401
}
tests {
test("selected auth overrides Authorization header always", function() {
const authHeader = req.getHeader("Authorization")
expect(authHeader).to.eql("Bearer ")
})
}

View File

@@ -11,7 +11,7 @@ get {
}
headers {
Authorization: Bearer your_secret_token
Authorization: Bearer {{bearer_auth_token}}
}
vars:pre-request {