Skip to content

Commit

Permalink
feat: adding a new example for encoded query parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
erunion committed Jan 26, 2022
1 parent 15b6271 commit 260fce8
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = {
'multipart-data': require('./src/multipart-data.har'),
'multipart-file': require('./src/multipart-file.har'),
'multipart-form-data': require('./src/multipart-form-data.har'),
'query-encoded': require('./src/query-encoded.har'),
query: require('./src/query.har'),
short: require('./src/short.har'),
'text-plain': require('./src/text-plain.har'),
Expand Down
74 changes: 74 additions & 0 deletions src/query-encoded.har.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
module.exports = {
log: {
entries: [
{
startedDateTime: new Date().toISOString(),
time: new Date().getMilliseconds(),
request: {
method: 'GET',
url: 'https://httpbin.org/anything',
httpVersion: 'HTTP/1.1',
cookies: [],
headers: [],
queryString: [
{
name: 'stringPound',
value: 'something%26nothing%3Dtrue',
},
{ name: 'stringHash', value: 'hash%23data' },
{ name: 'stringArray', value: 'where%5B4%5D%3D10' },
{
name: 'stringWeird',
value: 'properties%5B%22%24email%22%5D%20%3D%3D%20%22testing%22',
},
{
name: 'array',
value: 'something%26nothing%3Dtrue&array=nothing%26something%3Dfalse&array=another%20item',
},
],
bodySize: -1,
headersSize: 0,
},
response: {
status: 200,
statusText: 'OK',
httpVersion: 'HTTP/1.1',
headers: [
{ name: 'Accept', value: '*/*' },
{ name: 'Accept-Encoding', value: 'gzip,deflate' },
{ name: 'Host', value: 'httpbin.org' },
{ name: 'User-Agent', value: 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)' },
],
content: {
size: 495,
mimeType: 'application/json',
text: JSON.stringify({
args: {
array: ['something&nothing=true', 'nothing&something=false', 'another item'],
stringArray: 'where[4]=10',
stringHash: 'hash#data',
stringPound: 'something&nothing=true',
stringWeird: 'properties["$email"] == "testing"',
},
data: '',
files: {},
form: {},
headers: {
Accept: '*/*',
'Accept-Encoding': 'gzip,deflate',
Host: 'httpbin.org',
'User-Agent': 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)',
},
json: null,
method: 'GET',
origin: '127.0.0.1',
url: 'https://httpbin.org/anything?stringPound=something%26nothing%3Dtrue&stringHash=hash%23data&stringArray=where[4]%3D10&stringWeird=properties["%24email"] %3D%3D "testing"&array=something%26nothing%3Dtrue&array=nothing%26something%3Dfalse&array=another item',
}),
},
headersSize: -1,
bodySize: -1,
},
},
],
},
};

0 comments on commit 260fce8

Please sign in to comment.