Skip to content

Commit

Permalink
Merge pull request #57 from pactumjs/feat/add-faqs-page
Browse files Browse the repository at this point in the history
Add FAQ Page Section
  • Loading branch information
leelaprasadv authored Nov 11, 2024
2 parents 7461990 + 8b7a011 commit 27eabf1
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 4 deletions.
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).

0 comments on commit 27eabf1

Please sign in to comment.