mirror of
https://github.com/usebruno/bruno.git
synced 2024-12-04 22:00:41 +01:00
27 lines
465 B
Plaintext
27 lines
465 B
Plaintext
meta {
|
|
name: Basic Auth 200
|
|
type: http
|
|
seq: 1
|
|
}
|
|
|
|
post {
|
|
url: {{host}}/api/auth/basic/protected
|
|
body: json
|
|
auth: none
|
|
}
|
|
|
|
assert {
|
|
res.status: eq 200
|
|
res.body.message: Authentication successful
|
|
}
|
|
|
|
script:pre-request {
|
|
const username = "bruno";
|
|
const password = "della";
|
|
|
|
const authString = `${username}:${password}`;
|
|
const encodedAuthString = require('btoa')(authString);
|
|
|
|
req.setHeader("Authorization", `Basic ${encodedAuthString}`);
|
|
}
|