Skip to content

Commit

Permalink
Merge branch 'stoplightio:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ilanashapiro authored Nov 13, 2023
2 parents 6dd6cd6 + 5b17508 commit 8c648e8
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions docs/guides/07-http-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ const { URL } = require('url');

const operations = await getHttpOperationsFromSpec('examples/petstore.oas2.yaml');
const client = createClientFromOperations(operations, {
mock: false,
mock: { dynamic: false },
validateRequest: true,
validateResponse: true,
checkSecurity: false,
errors: true,
upstream: new URL('https://api.example.com'),
upstream: new URL('https://api.example.com'),
upstreamProxy: undefined,
isProxy: true,
});
```

Expand Down Expand Up @@ -57,13 +58,14 @@ const client = createClientFromOperations(
},
],
{
mock: false,
mock: { dynamic: false },
validateRequest: true,
validateResponse: true,
checkSecurity: false,
errors: true,
upstream: new URL('https://api.example.com'),
upstream: new URL('https://api.example.com'),
upstreamProxy: undefined,
isProxy: true,
}
);
```
Expand Down Expand Up @@ -94,7 +96,7 @@ This disables response validation _only for the current request_
You can do the same thing using the shortcut methods

```ts
client.get('https://google.it', { mock: false }).then(console.log);
client.get('https://google.it', { mock: { dynamic: false } }).then(console.log);
```

For the shortcut methods (since the only mandatory option is intrinsic in the function name) the option parameter can be omitted
Expand All @@ -120,6 +122,6 @@ client.get('/users/10', { baseUrl: 'https://api.stoplight.io/' }).then(console.l
```ts
client.request('https://google.it', { method: 'get' }, { mock: { dynamic: true } }).then(console.log);
client
.request('https://google.it', { method: 'get' }, { mock: false, upstream: new URL('https://api.example.com') })
.request('https://google.it', { method: 'get' }, { isProxy: true, upstream: new URL('https://api.example.com') })
.then(console.log);
```

0 comments on commit 8c648e8

Please sign in to comment.