-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from pactumjs/feat/add-faqs-page
Add FAQ Page Section
- Loading branch information
Showing
3 changed files
with
58 additions
and
4 deletions.
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
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
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,45 @@ | ||
# Frequently Asked Questions (FAQs) | ||
|
||
<!-- Table of Contents --> | ||
- [What is the http client used by PactumJS](#what-is-the-http-client-used-by-pactumjs) | ||
- [Can PactumJS conditionally proxy or pass through requests sent to mock server to external servers?](#can-pactumjs-conditionally-proxy-or-pass-through-requests-sent-to-mock-server-to-external-servers) | ||
- [How disable or ignore SSL certificate errors in PactumJS?](#how-disable-or-ignore-ssl-certificate-errors-in-pactumjs) | ||
- [What kinds of API testing does PactumJS?](#what-kinds-of-api-testing-does-pactumjs) | ||
|
||
--- | ||
|
||
## What is the http client used by PactumJS | ||
|
||
PactumJS under the hood uses [phin.js](https://github.com/ethanent/phin) for http/https requests. | ||
|
||
## Can PactumJS conditionally proxy or pass through requests sent to mock server to external servers? | ||
|
||
PactumJS currently cannot conditionally proxy or pass-through requests, be it in full or partial sent to mock server to external servers. | ||
|
||
## How disable or ignore SSL certificate errors in PactumJS? | ||
|
||
Yes, it is possible to disable SSL certificate checks/erros similar to "" in NodeJS. Set the `rejectUnauthorized` flag to `false` in the `agent` configuration before firing the request. | ||
|
||
```js | ||
const https = require('https'); | ||
const pactum = require('pactum'); | ||
|
||
// If you have the cert/key pair | ||
const key = fs.readFileSync("server.key") | ||
const cert = fs.readFileSync("server.crt") | ||
|
||
const agent = new https.Agent({ | ||
cert: cert, // Optional - add if cert available | ||
key: key, // Optional - add if key is available | ||
rejectUnauthorized: false // Ignore certificate errors | ||
}); | ||
|
||
pactum.spec() | ||
.get('https://api.example.com') | ||
.withCore({agent: agent }) | ||
.expectStatus(200) | ||
``` | ||
|
||
## What kinds of API testing does PactumJS? | ||
PactumJS currently only support REST/GraphQL API testing over http(s). | ||
|