Skip to content

Commit 27eabf1

Browse files
authored
Merge pull request #57 from pactumjs/feat/add-faqs-page
Add FAQ Page Section
2 parents 7461990 + 8b7a011 commit 27eabf1

File tree

3 files changed

+58
-4
lines changed

3 files changed

+58
-4
lines changed

docs/.vitepress/components/Converter.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<button class="convert-button" @click="convertCurl">
2222
Convert
2323
</button>
24-
<button class="convert-button clear" @click="clearOutput">
24+
<button class="convert-button" @click="clearOutput">
2525
Clear
2626
</button>
2727
</div>
@@ -48,7 +48,7 @@ const generatedCode = ref('')
4848
const clearOutput = () => {
4949
generatedCode.value = ''
5050
}
51-
51+
5252
const parseCurl = (curlCommand) => {
5353
if (!curlCommand) {
5454
clearOutput()
@@ -204,11 +204,12 @@ select {
204204
.convert-button {
205205
background-color: var(--vp-c-brand);
206206
color: white;
207-
padding: 8px 16px;
207+
padding: 2px 12px;
208208
border: none;
209209
border-radius: 6px;
210210
cursor: pointer;
211211
font-weight: 500;
212+
margin: 5px;
212213
}
213214
214215
.convert-button:hover {

docs/.vitepress/config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,14 @@ const home_sidebar = [
4545
{ text: 'Videos', link: '/media/videos' },
4646
{ text: 'Projects', link: '/media/projects' }
4747
]
48-
}
48+
},
49+
{
50+
text: "💁 FAQs",
51+
collapsed: false,
52+
items: [
53+
{ text: 'Q&A', link: '/faq/qna' },
54+
]
55+
},
4956
];
5057

5158
const tools_sidebar = [
@@ -309,6 +316,7 @@ const config = defineConfig({
309316
'/introduction': home_sidebar,
310317
'/guides': home_sidebar,
311318
'/media': home_sidebar,
319+
'/faq': home_sidebar,
312320
'/api': api_sidebar,
313321
'/tools': tools_sidebar
314322
},

docs/faq/qna.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Frequently Asked Questions (FAQs)
2+
3+
<!-- Table of Contents -->
4+
- [What is the http client used by PactumJS](#what-is-the-http-client-used-by-pactumjs)
5+
- [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)
6+
- [How disable or ignore SSL certificate errors in PactumJS?](#how-disable-or-ignore-ssl-certificate-errors-in-pactumjs)
7+
- [What kinds of API testing does PactumJS?](#what-kinds-of-api-testing-does-pactumjs)
8+
9+
---
10+
11+
## What is the http client used by PactumJS
12+
13+
PactumJS under the hood uses [phin.js](https://github.com/ethanent/phin) for http/https requests.
14+
15+
## Can PactumJS conditionally proxy or pass through requests sent to mock server to external servers?
16+
17+
PactumJS currently cannot conditionally proxy or pass-through requests, be it in full or partial sent to mock server to external servers.
18+
19+
## How disable or ignore SSL certificate errors in PactumJS?
20+
21+
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.
22+
23+
```js
24+
const https = require('https');
25+
const pactum = require('pactum');
26+
27+
// If you have the cert/key pair
28+
const key = fs.readFileSync("server.key")
29+
const cert = fs.readFileSync("server.crt")
30+
31+
const agent = new https.Agent({
32+
cert: cert, // Optional - add if cert available
33+
key: key, // Optional - add if key is available
34+
rejectUnauthorized: false // Ignore certificate errors
35+
});
36+
37+
pactum.spec()
38+
.get('https://api.example.com')
39+
.withCore({agent: agent })
40+
.expectStatus(200)
41+
```
42+
43+
## What kinds of API testing does PactumJS?
44+
PactumJS currently only support REST/GraphQL API testing over http(s).
45+

0 commit comments

Comments
 (0)