Skip to content

Commit

Permalink
GITBOOK-304: change request with no subject merged in GitBook
Browse files Browse the repository at this point in the history
  • Loading branch information
axelniklasson authored and gitbook-bot committed May 2, 2023
1 parent 532413c commit 679c942
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
10 changes: 5 additions & 5 deletions advanced/javascript/make-http-s-requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Maestro comes with its own JavaScript HTTP API

```javascript
// script.js
var response = http.get('https://example.com')
const response = http.get('https://example.com')

output.script.result = response.body
```
Expand All @@ -27,7 +27,7 @@ For example, assume that `https://example.com/jsonEndpoint` returns the followin

```javascript
// script.js
var response = http.get('https://example.com/jsonEndpoint')
const response = http.get('https://example.com/jsonEndpoint')

output.script.result = json(response.body).myField.mySubField
```
Expand All @@ -38,7 +38,7 @@ To send body to a given endpoint, specify a `body` parameter:

```javascript
// script.js
var response = http.post('https://example.com/myEndpoint', {
const response = http.post('https://example.com/myEndpoint', {
body: JSON.stringify(
{
myField: "Payload"
Expand All @@ -53,7 +53,7 @@ Headers can be provided in a `headers` parameter

```javascript
// script.js
var response = http.get('https://example.com', {
const response = http.get('https://example.com', {
headers: {
Authorization: 'Bearer MyToken'
}
Expand All @@ -73,7 +73,7 @@ To send a request of any other HTTP method, use `http.request`

```javascript
// script.js
var response = http.request('https://example.com`, {
const response = http.request('https://example.com`, {
method: "GET" // or specify any other method, i.e. OPTION
})
```
Expand Down
19 changes: 8 additions & 11 deletions examples/advanced-wikipedia-android.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,21 +273,18 @@ appId: org.wikimedia
{% tab title="generateCredentials.js" %}
```javascript
function username() {
var date = new Date().getTime().toString();
var username = `test_user_placeholder`.replace("placeholder", date);
return username;
const date = new Date().getTime().toString();
return `test_user_${date}`;
}

function email() {
var date = new Date().getTime().toString();
var email = `test-user-placeholder@test.com`.replace("placeholder", date);
return email;
const date = new Date().getTime().toString();
return `test-user-${date}@test.com`;
}

function password() {
var date = new Date().getTime().toString();
var password = `test-user-password-placeholder`.replace("placeholder", date);
return password;
const date = new Date().getTime().toString();
return `test-user-password-${date}`;
}

output.credentials = {
Expand All @@ -304,8 +301,8 @@ output.credentials = {
// Fetches test user from API
function getTestUserFromApi() {
const url = `https://jsonplaceholder.typicode.com/users/1`;
var response = http.get(url);
var data = json(response.body);
const response = http.get(url);
const data = json(response.body);

return {
username: data.username,
Expand Down

0 comments on commit 679c942

Please sign in to comment.