mirror of
https://github.com/usebruno/bruno.git
synced 2025-02-03 19:39:23 +01:00
27 lines
443 B
Plaintext
27 lines
443 B
Plaintext
|
meta {
|
||
|
name: Basic Auth 401
|
||
|
type: http
|
||
|
seq: 2
|
||
|
}
|
||
|
|
||
|
post {
|
||
|
url: {{host}}/api/auth/basic/protected
|
||
|
body: json
|
||
|
auth: none
|
||
|
}
|
||
|
|
||
|
assert {
|
||
|
res.status: 401
|
||
|
res.body: Unauthorized
|
||
|
}
|
||
|
|
||
|
script:pre-request {
|
||
|
const username = "bruno";
|
||
|
const password = "invalid";
|
||
|
|
||
|
const authString = `${username}:${password}`;
|
||
|
const encodedAuthString = require('btoa')(authString);
|
||
|
|
||
|
req.setHeader("Authorization", `Basic ${encodedAuthString}`);
|
||
|
}
|