mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-24 13:15:40 +00:00
feat: safe mode updates
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: echo json
|
||||
type: http
|
||||
seq: 1
|
||||
seq: 2
|
||||
}
|
||||
|
||||
post {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: echo plaintext
|
||||
type: http
|
||||
seq: 2
|
||||
seq: 3
|
||||
}
|
||||
|
||||
post {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: echo xml parsed
|
||||
type: http
|
||||
seq: 3
|
||||
seq: 4
|
||||
}
|
||||
|
||||
post {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: echo xml raw
|
||||
type: http
|
||||
seq: 4
|
||||
seq: 5
|
||||
}
|
||||
|
||||
post {
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
meta {
|
||||
name: getEnvName
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{host}}/ping
|
||||
body: none
|
||||
auth: none
|
||||
}
|
||||
|
||||
auth:awsv4 {
|
||||
accessKeyId: a
|
||||
secretAccessKey: b
|
||||
sessionToken: c
|
||||
service: d
|
||||
region: e
|
||||
profileName: f
|
||||
}
|
||||
|
||||
script:pre-request {
|
||||
const envName = bru.getEnvName();
|
||||
bru.setVar("testEnvName", envName);
|
||||
}
|
||||
|
||||
tests {
|
||||
test("should get env name in scripts", function() {
|
||||
const testEnvName = bru.getVar("testEnvName");
|
||||
expect(testEnvName).to.equal("Prod");
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
meta {
|
||||
name: getEnvVar
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{host}}/ping
|
||||
body: none
|
||||
auth: none
|
||||
}
|
||||
|
||||
auth:awsv4 {
|
||||
accessKeyId: a
|
||||
secretAccessKey: b
|
||||
sessionToken: c
|
||||
service: d
|
||||
region: e
|
||||
profileName: f
|
||||
}
|
||||
|
||||
tests {
|
||||
test("should get env var in scripts", function() {
|
||||
const host = bru.getEnvVar("host")
|
||||
expect(host).to.equal("https://testbench-sanity.usebruno.com");
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
meta {
|
||||
name: getProcessEnv
|
||||
type: http
|
||||
seq: 6
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{host}}/ping
|
||||
body: none
|
||||
auth: none
|
||||
}
|
||||
|
||||
auth:awsv4 {
|
||||
accessKeyId: a
|
||||
secretAccessKey: b
|
||||
sessionToken: c
|
||||
service: d
|
||||
region: e
|
||||
profileName: f
|
||||
}
|
||||
|
||||
tests {
|
||||
test("bru.getProcessEnv()", function() {
|
||||
const v = bru.getProcessEnv("PROC_ENV_VAR");
|
||||
expect(v).to.equal("woof");
|
||||
});
|
||||
}
|
||||
27
packages/bruno-tests/collection/scripting/api/bru/getVar.bru
Normal file
27
packages/bruno-tests/collection/scripting/api/bru/getVar.bru
Normal file
@@ -0,0 +1,27 @@
|
||||
meta {
|
||||
name: getVar
|
||||
type: http
|
||||
seq: 5
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{host}}/ping
|
||||
body: none
|
||||
auth: none
|
||||
}
|
||||
|
||||
auth:awsv4 {
|
||||
accessKeyId: a
|
||||
secretAccessKey: b
|
||||
sessionToken: c
|
||||
service: d
|
||||
region: e
|
||||
profileName: f
|
||||
}
|
||||
|
||||
tests {
|
||||
test("should get var in scripts", function() {
|
||||
const testSetVar = bru.getVar("testSetVar");
|
||||
expect(testSetVar).to.equal("bruno-test-87267");
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
meta {
|
||||
name: setEnvVar
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{host}}/ping
|
||||
body: none
|
||||
auth: none
|
||||
}
|
||||
|
||||
auth:awsv4 {
|
||||
accessKeyId: a
|
||||
secretAccessKey: b
|
||||
sessionToken: c
|
||||
service: d
|
||||
region: e
|
||||
profileName: f
|
||||
}
|
||||
|
||||
script:post-response {
|
||||
bru.setEnvVar("testSetEnvVar", "bruno-29653")
|
||||
}
|
||||
|
||||
tests {
|
||||
test("should set env var in scripts", function() {
|
||||
const testSetEnvVar = bru.getEnvVar("testSetEnvVar")
|
||||
expect(testSetEnvVar).to.equal("bruno-29653");
|
||||
});
|
||||
}
|
||||
31
packages/bruno-tests/collection/scripting/api/bru/setVar.bru
Normal file
31
packages/bruno-tests/collection/scripting/api/bru/setVar.bru
Normal file
@@ -0,0 +1,31 @@
|
||||
meta {
|
||||
name: setVar
|
||||
type: http
|
||||
seq: 4
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{host}}/ping
|
||||
body: none
|
||||
auth: none
|
||||
}
|
||||
|
||||
auth:awsv4 {
|
||||
accessKeyId: a
|
||||
secretAccessKey: b
|
||||
sessionToken: c
|
||||
service: d
|
||||
region: e
|
||||
profileName: f
|
||||
}
|
||||
|
||||
script:post-response {
|
||||
bru.setVar("testSetVar", "bruno-test-87267")
|
||||
}
|
||||
|
||||
tests {
|
||||
test("should get var in scripts", function() {
|
||||
const testSetVar = bru.getVar("testSetVar");
|
||||
expect(testSetVar).to.equal("bruno-test-87267");
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
meta {
|
||||
name: getBody
|
||||
type: http
|
||||
seq: 9
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{host}}/api/echo/json
|
||||
body: json
|
||||
auth: none
|
||||
}
|
||||
|
||||
auth:basic {
|
||||
username: asd
|
||||
password: j
|
||||
}
|
||||
|
||||
auth:bearer {
|
||||
token:
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"hello": "bruno"
|
||||
}
|
||||
}
|
||||
|
||||
assert {
|
||||
res.status: eq 200
|
||||
}
|
||||
|
||||
tests {
|
||||
test("req.getBody()", function() {
|
||||
const data = res.getBody();
|
||||
expect(data).to.eql({
|
||||
"hello": "bruno"
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
meta {
|
||||
name: getHeader
|
||||
type: http
|
||||
seq: 5
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{host}}/ping
|
||||
body: none
|
||||
auth: none
|
||||
}
|
||||
|
||||
headers {
|
||||
bruno: is-awesome
|
||||
}
|
||||
|
||||
auth:awsv4 {
|
||||
accessKeyId: a
|
||||
secretAccessKey: b
|
||||
sessionToken: c
|
||||
service: d
|
||||
region: e
|
||||
profileName: f
|
||||
}
|
||||
|
||||
assert {
|
||||
res.status: eq 200
|
||||
res.body: eq pong
|
||||
}
|
||||
|
||||
tests {
|
||||
test("req.getHeader(name)", function() {
|
||||
const h = req.getHeader('bruno');
|
||||
expect(h).to.equal("is-awesome");
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
meta {
|
||||
name: getHeaders
|
||||
type: http
|
||||
seq: 7
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{host}}/ping
|
||||
body: none
|
||||
auth: none
|
||||
}
|
||||
|
||||
headers {
|
||||
bruno: is-awesome
|
||||
della: is-beautiful
|
||||
}
|
||||
|
||||
auth:awsv4 {
|
||||
accessKeyId: a
|
||||
secretAccessKey: b
|
||||
sessionToken: c
|
||||
service: d
|
||||
region: e
|
||||
profileName: f
|
||||
}
|
||||
|
||||
assert {
|
||||
res.status: eq 200
|
||||
res.body: eq pong
|
||||
}
|
||||
|
||||
tests {
|
||||
test("req.getHeaders()", function() {
|
||||
const h = req.getHeaders();
|
||||
expect(h.bruno).to.equal("is-awesome");
|
||||
expect(h.della).to.equal("is-beautiful");
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
meta {
|
||||
name: getMethod
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{host}}/ping
|
||||
body: none
|
||||
auth: none
|
||||
}
|
||||
|
||||
auth:awsv4 {
|
||||
accessKeyId: a
|
||||
secretAccessKey: b
|
||||
sessionToken: c
|
||||
service: d
|
||||
region: e
|
||||
profileName: f
|
||||
}
|
||||
|
||||
assert {
|
||||
res.status: eq 200
|
||||
res.body: eq pong
|
||||
}
|
||||
|
||||
tests {
|
||||
test("req.getMethod()()", function() {
|
||||
const method = req.getMethod();
|
||||
expect(method).to.equal("GET");
|
||||
});
|
||||
}
|
||||
32
packages/bruno-tests/collection/scripting/api/req/getUrl.bru
Normal file
32
packages/bruno-tests/collection/scripting/api/req/getUrl.bru
Normal file
@@ -0,0 +1,32 @@
|
||||
meta {
|
||||
name: getUrl
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{host}}/ping
|
||||
body: none
|
||||
auth: none
|
||||
}
|
||||
|
||||
auth:awsv4 {
|
||||
accessKeyId: a
|
||||
secretAccessKey: b
|
||||
sessionToken: c
|
||||
service: d
|
||||
region: e
|
||||
profileName: f
|
||||
}
|
||||
|
||||
assert {
|
||||
res.status: eq 200
|
||||
res.body: eq pong
|
||||
}
|
||||
|
||||
tests {
|
||||
test("req.getUrl()", function() {
|
||||
const url = req.getUrl();
|
||||
expect(url).to.equal("https://testbench-sanity.usebruno.com/ping");
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
meta {
|
||||
name: setBody
|
||||
type: http
|
||||
seq: 10
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{host}}/api/echo/json
|
||||
body: json
|
||||
auth: none
|
||||
}
|
||||
|
||||
auth:basic {
|
||||
username: asd
|
||||
password: j
|
||||
}
|
||||
|
||||
auth:bearer {
|
||||
token:
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"hello": "bruno"
|
||||
}
|
||||
}
|
||||
|
||||
assert {
|
||||
res.status: eq 200
|
||||
}
|
||||
|
||||
script:pre-request {
|
||||
req.setBody({
|
||||
"bruno": "is awesome"
|
||||
});
|
||||
}
|
||||
|
||||
tests {
|
||||
test("req.setBody()", function() {
|
||||
const data = res.getBody();
|
||||
expect(data).to.eql({
|
||||
"bruno": "is awesome"
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
meta {
|
||||
name: setHeader
|
||||
type: http
|
||||
seq: 6
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{host}}/ping
|
||||
body: none
|
||||
auth: none
|
||||
}
|
||||
|
||||
headers {
|
||||
bruno: is-awesome
|
||||
}
|
||||
|
||||
auth:awsv4 {
|
||||
accessKeyId: a
|
||||
secretAccessKey: b
|
||||
sessionToken: c
|
||||
service: d
|
||||
region: e
|
||||
profileName: f
|
||||
}
|
||||
|
||||
assert {
|
||||
res.status: eq 200
|
||||
res.body: eq pong
|
||||
}
|
||||
|
||||
script:pre-request {
|
||||
req.setHeader('bruno', 'is-the-future');
|
||||
}
|
||||
|
||||
tests {
|
||||
test("req.setHeader(name)", function() {
|
||||
const h = req.getHeader('bruno');
|
||||
expect(h).to.equal("is-the-future");
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
meta {
|
||||
name: setHeaders
|
||||
type: http
|
||||
seq: 8
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{host}}/ping
|
||||
body: none
|
||||
auth: none
|
||||
}
|
||||
|
||||
headers {
|
||||
bruno: is-awesome
|
||||
della: is-beautiful
|
||||
}
|
||||
|
||||
auth:awsv4 {
|
||||
accessKeyId: a
|
||||
secretAccessKey: b
|
||||
sessionToken: c
|
||||
service: d
|
||||
region: e
|
||||
profileName: f
|
||||
}
|
||||
|
||||
assert {
|
||||
res.status: eq 200
|
||||
res.body: eq pong
|
||||
}
|
||||
|
||||
script:pre-request {
|
||||
req.setHeaders({
|
||||
"content-type": "application/text",
|
||||
"transaction-id": "foobar"
|
||||
});
|
||||
}
|
||||
|
||||
tests {
|
||||
test("req.setHeaders()", function() {
|
||||
const h = req.getHeaders();
|
||||
expect(h['content-type']).to.equal("application/text");
|
||||
expect(h['transaction-id']).to.equal("foobar");
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
meta {
|
||||
name: setMethod
|
||||
type: http
|
||||
seq: 4
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{host}}/ping
|
||||
body: none
|
||||
auth: none
|
||||
}
|
||||
|
||||
auth:awsv4 {
|
||||
accessKeyId: a
|
||||
secretAccessKey: b
|
||||
sessionToken: c
|
||||
service: d
|
||||
region: e
|
||||
profileName: f
|
||||
}
|
||||
|
||||
assert {
|
||||
res.status: eq 200
|
||||
res.body: eq pong
|
||||
}
|
||||
|
||||
script:pre-request {
|
||||
req.setMethod("GET");
|
||||
}
|
||||
|
||||
tests {
|
||||
test("req.setMethod()()", function() {
|
||||
const method = req.getMethod();
|
||||
expect(method).to.equal("GET");
|
||||
});
|
||||
}
|
||||
36
packages/bruno-tests/collection/scripting/api/req/setUrl.bru
Normal file
36
packages/bruno-tests/collection/scripting/api/req/setUrl.bru
Normal file
@@ -0,0 +1,36 @@
|
||||
meta {
|
||||
name: setUrl
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{host}}/ping/invalid
|
||||
body: none
|
||||
auth: none
|
||||
}
|
||||
|
||||
auth:awsv4 {
|
||||
accessKeyId: a
|
||||
secretAccessKey: b
|
||||
sessionToken: c
|
||||
service: d
|
||||
region: e
|
||||
profileName: f
|
||||
}
|
||||
|
||||
assert {
|
||||
res.status: eq 200
|
||||
res.body: eq pong
|
||||
}
|
||||
|
||||
script:pre-request {
|
||||
req.setUrl("https://testbench-sanity.usebruno.com/ping");
|
||||
}
|
||||
|
||||
tests {
|
||||
test("req.setUrl()", function() {
|
||||
const url = req.getUrl();
|
||||
expect(url).to.equal("https://testbench-sanity.usebruno.com/ping");
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
meta {
|
||||
name: getBody
|
||||
type: http
|
||||
seq: 4
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{host}}/api/echo/json
|
||||
body: json
|
||||
auth: none
|
||||
}
|
||||
|
||||
auth:basic {
|
||||
username: asd
|
||||
password: j
|
||||
}
|
||||
|
||||
auth:bearer {
|
||||
token:
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"hello": "bruno"
|
||||
}
|
||||
}
|
||||
|
||||
assert {
|
||||
res.status: eq 200
|
||||
}
|
||||
|
||||
tests {
|
||||
test("res.getBody()", function() {
|
||||
const data = res.getBody();
|
||||
expect(data).to.eql({
|
||||
"hello": "bruno"
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
meta {
|
||||
name: getHeader
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{host}}/api/echo/json
|
||||
body: json
|
||||
auth: none
|
||||
}
|
||||
|
||||
auth:basic {
|
||||
username: asd
|
||||
password: j
|
||||
}
|
||||
|
||||
auth:bearer {
|
||||
token:
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"hello": "bruno"
|
||||
}
|
||||
}
|
||||
|
||||
assert {
|
||||
res.status: eq 200
|
||||
}
|
||||
|
||||
tests {
|
||||
test("res.getHeader(name)", function() {
|
||||
const server = res.getHeader('x-powered-by');
|
||||
expect(server).to.eql('Express');
|
||||
});
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
meta {
|
||||
name: getHeaders
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{host}}/api/echo/json
|
||||
body: json
|
||||
auth: none
|
||||
}
|
||||
|
||||
auth:basic {
|
||||
username: asd
|
||||
password: j
|
||||
}
|
||||
|
||||
auth:bearer {
|
||||
token:
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"hello": "bruno"
|
||||
}
|
||||
}
|
||||
|
||||
assert {
|
||||
res.status: eq 200
|
||||
}
|
||||
|
||||
tests {
|
||||
test("res.getHeaders(name)", function() {
|
||||
const h = res.getHeaders();
|
||||
expect(h['x-powered-by']).to.eql('Express');
|
||||
expect(h['content-length']).to.eql('17');
|
||||
});
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
meta {
|
||||
name: getResponseTime
|
||||
type: http
|
||||
seq: 5
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{host}}/api/echo/json
|
||||
body: json
|
||||
auth: none
|
||||
}
|
||||
|
||||
auth:basic {
|
||||
username: asd
|
||||
password: j
|
||||
}
|
||||
|
||||
auth:bearer {
|
||||
token:
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"hello": "bruno"
|
||||
}
|
||||
}
|
||||
|
||||
assert {
|
||||
res.status: eq 200
|
||||
}
|
||||
|
||||
tests {
|
||||
test("res.getResponseTime()", function() {
|
||||
const responseTime = res.getResponseTime();
|
||||
expect(typeof responseTime).to.eql("number");
|
||||
expect(responseTime > 0).to.be.true;
|
||||
});
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
meta {
|
||||
name: getStatus
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{host}}/ping
|
||||
body: none
|
||||
auth: none
|
||||
}
|
||||
|
||||
auth:awsv4 {
|
||||
accessKeyId: a
|
||||
secretAccessKey: b
|
||||
sessionToken: c
|
||||
service: d
|
||||
region: e
|
||||
profileName: f
|
||||
}
|
||||
|
||||
assert {
|
||||
res.status: eq 200
|
||||
res.body: eq pong
|
||||
}
|
||||
|
||||
tests {
|
||||
test("res.getStatus()", function() {
|
||||
const status = res.getStatus()
|
||||
expect(status).to.equal(200);
|
||||
});
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
meta {
|
||||
name: get-env-name
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{host}}/ping
|
||||
body: none
|
||||
auth: none
|
||||
}
|
||||
|
||||
auth:awsv4 {
|
||||
accessKeyId: a
|
||||
secretAccessKey: b
|
||||
sessionToken: c
|
||||
service: d
|
||||
region: e
|
||||
profileName: f
|
||||
}
|
||||
|
||||
script:pre-request {
|
||||
const envName = bru.getEnvName();
|
||||
bru.setVar("testEnvName", envName);
|
||||
}
|
||||
|
||||
tests {
|
||||
test("should get env name in scripts", function() {
|
||||
const testEnvName = bru.getVar("testEnvName");
|
||||
expect(testEnvName).to.equal("Prod");
|
||||
});
|
||||
}
|
||||
|
||||
docs {
|
||||
# API Documentation
|
||||
|
||||
## Introduction
|
||||
|
||||
Welcome to the API documentation for [Your API Name]. This document provides instructions on how to make requests to the API and covers available authentication methods.
|
||||
|
||||
## Authentication
|
||||
|
||||
Before making requests to the API, you need to authenticate your application. [Your API Name] supports the following authentication methods:
|
||||
|
||||
### API Key
|
||||
|
||||
To use API key authentication, include your API key in the request headers as follows:
|
||||
|
||||
```http
|
||||
GET /api/endpoint
|
||||
Host: api.example.com
|
||||
Authorization: Bearer YOUR_API_KEY
|
||||
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
meta {
|
||||
name: get-env-var
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{host}}/ping
|
||||
body: none
|
||||
auth: none
|
||||
}
|
||||
|
||||
auth:awsv4 {
|
||||
accessKeyId: a
|
||||
secretAccessKey: b
|
||||
sessionToken: c
|
||||
service: d
|
||||
region: e
|
||||
profileName: f
|
||||
}
|
||||
|
||||
tests {
|
||||
test("should get env var in scripts", function() {
|
||||
const host = bru.getEnvVar("host")
|
||||
expect(host).to.equal("https://testbench-sanity.usebruno.com");
|
||||
});
|
||||
}
|
||||
|
||||
docs {
|
||||
# API Documentation
|
||||
|
||||
## Introduction
|
||||
|
||||
Welcome to the API documentation for [Your API Name]. This document provides instructions on how to make requests to the API and covers available authentication methods.
|
||||
|
||||
## Authentication
|
||||
|
||||
Before making requests to the API, you need to authenticate your application. [Your API Name] supports the following authentication methods:
|
||||
|
||||
### API Key
|
||||
|
||||
To use API key authentication, include your API key in the request headers as follows:
|
||||
|
||||
```http
|
||||
GET /api/endpoint
|
||||
Host: api.example.com
|
||||
Authorization: Bearer YOUR_API_KEY
|
||||
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
meta {
|
||||
name: set-env-var
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{host}}/ping
|
||||
body: none
|
||||
auth: none
|
||||
}
|
||||
|
||||
auth:awsv4 {
|
||||
accessKeyId: a
|
||||
secretAccessKey: b
|
||||
sessionToken: c
|
||||
service: d
|
||||
region: e
|
||||
profileName: f
|
||||
}
|
||||
|
||||
script:post-response {
|
||||
bru.setEnvVar("testSetEnvVar", "bruno-29653")
|
||||
}
|
||||
|
||||
tests {
|
||||
test("should set env var in scripts", function() {
|
||||
const testSetEnvVar = bru.getEnvVar("testSetEnvVar")
|
||||
console.log(testSetEnvVar);
|
||||
expect(testSetEnvVar).to.equal("bruno-29653");
|
||||
});
|
||||
}
|
||||
|
||||
docs {
|
||||
# API Documentation
|
||||
|
||||
## Introduction
|
||||
|
||||
Welcome to the API documentation for [Your API Name]. This document provides instructions on how to make requests to the API and covers available authentication methods.
|
||||
|
||||
## Authentication
|
||||
|
||||
Before making requests to the API, you need to authenticate your application. [Your API Name] supports the following authentication methods:
|
||||
|
||||
### API Key
|
||||
|
||||
To use API key authentication, include your API key in the request headers as follows:
|
||||
|
||||
```http
|
||||
GET /api/endpoint
|
||||
Host: api.example.com
|
||||
Authorization: Bearer YOUR_API_KEY
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user