Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FAQ Page Section #57

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/.vitepress/components/Converter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<button class="convert-button" @click="convertCurl">
Convert
</button>
<button class="convert-button clear" @click="clearOutput">
<button class="convert-button" @click="clearOutput">
Clear
</button>
</div>
Expand All @@ -48,7 +48,7 @@ const generatedCode = ref('')
const clearOutput = () => {
generatedCode.value = ''
}

const parseCurl = (curlCommand) => {
if (!curlCommand) {
clearOutput()
Expand Down Expand Up @@ -204,11 +204,12 @@ select {
.convert-button {
background-color: var(--vp-c-brand);
color: white;
padding: 8px 16px;
padding: 2px 12px;
border: none;
border-radius: 6px;
cursor: pointer;
font-weight: 500;
margin: 5px;
}

.convert-button:hover {
Expand Down
10 changes: 9 additions & 1 deletion docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ const home_sidebar = [
{ text: 'Videos', link: '/media/videos' },
{ text: 'Projects', link: '/media/projects' }
]
}
},
{
text: "💁 FAQs",
collapsed: false,
items: [
{ text: 'Q&A', link: '/faq/qna' },
]
},
];

const tools_sidebar = [
Expand Down Expand Up @@ -309,6 +316,7 @@ const config = defineConfig({
'/introduction': home_sidebar,
'/guides': home_sidebar,
'/media': home_sidebar,
'/faq': home_sidebar,
'/api': api_sidebar,
'/tools': tools_sidebar
},
Expand Down
45 changes: 45 additions & 0 deletions docs/faq/qna.md
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).