-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add: sendRequest in hintWords and created bru file for each method
- Loading branch information
1 parent
e4f3f05
commit 46bd9af
Showing
6 changed files
with
130 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/bruno-tests/collection/scripting/api/bru/sendRequest/deleteRequest.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
meta { | ||
name: deleteRequest | ||
type: http | ||
seq: 8 | ||
} | ||
|
||
get { | ||
url: {{host}}/ping | ||
body: none | ||
auth: none | ||
} | ||
|
||
tests { | ||
test("should delete post", function() { | ||
const deleteRequest = await bru.sendRequest({ | ||
url: 'https://jsonplaceholder.typicode.com/posts/1', | ||
method: 'DELETE' | ||
}); | ||
console.log('DELETE Status:', deleteRequest.code); | ||
}); | ||
} |
29 changes: 29 additions & 0 deletions
29
packages/bruno-tests/collection/scripting/api/bru/sendRequest/getRequest.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
meta { | ||
name: getRequest | ||
type: http | ||
seq: 8 | ||
} | ||
|
||
get { | ||
url: {{host}}/ping | ||
body: none | ||
auth: none | ||
} | ||
|
||
tests { | ||
test("should get data", function() { | ||
const getRequest = await bru.sendRequest( | ||
{ | ||
url: 'https://jsonplaceholder.typicode.com/posts/1', | ||
method: 'GET', | ||
}, | ||
(error, response) => { | ||
if (error) { | ||
console.error('GET Request failed:', error); | ||
return; | ||
} | ||
console.log('GET Response via callback:', response.body); | ||
} | ||
); | ||
}); | ||
} |
25 changes: 25 additions & 0 deletions
25
packages/bruno-tests/collection/scripting/api/bru/sendRequest/patchRequest.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
meta { | ||
name: patchRequest | ||
type: http | ||
seq: 8 | ||
} | ||
|
||
get { | ||
url: {{host}}/ping | ||
body: none | ||
auth: none | ||
} | ||
|
||
tests { | ||
test("should patch existing post", function() { | ||
const patchRequest = await bru.sendRequest({ | ||
url: 'https://jsonplaceholder.typicode.com/posts/1', | ||
method: 'PATCH', | ||
headers: { 'Content-Type': 'application/json' }, | ||
data: { | ||
title: 'Only Update Title' | ||
} | ||
}); | ||
console.log('PATCH Response:', patchRequest.body); | ||
}); | ||
} |
25 changes: 25 additions & 0 deletions
25
packages/bruno-tests/collection/scripting/api/bru/sendRequest/postRequest.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
meta { | ||
name: postRequest | ||
type: http | ||
seq: 8 | ||
} | ||
|
||
get { | ||
url: {{host}}/ping | ||
body: none | ||
auth: none | ||
} | ||
|
||
tests { | ||
test("should create new post", function() { | ||
const createPost = await bru.sendRequest({ | ||
url: 'https://jsonplaceholder.typicode.com/posts', | ||
method: 'POST', | ||
data: { | ||
title: 'New Post', | ||
body: 'New Content', | ||
userId: 1 | ||
} | ||
}); | ||
}); | ||
} |
27 changes: 27 additions & 0 deletions
27
packages/bruno-tests/collection/scripting/api/bru/sendRequest/putRequest.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
meta { | ||
name: putRequest | ||
type: http | ||
seq: 8 | ||
} | ||
|
||
get { | ||
url: {{host}}/ping | ||
body: none | ||
auth: none | ||
} | ||
|
||
tests { | ||
test("should update entire post with PUT request", function() { | ||
const putRequest = await bru.sendRequest({ | ||
url: 'https://jsonplaceholder.typicode.com/posts/1', | ||
method: 'PUT', | ||
headers: { 'Content-Type': 'application/json' }, | ||
body: { | ||
id: 1, | ||
title: 'Updated Title', | ||
userId: 1 | ||
} | ||
},); | ||
console.log('PUT Response:', putRequest.body); | ||
}); | ||
} |