@readme/httpsnippet 8.1.4 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +7 -7
- package/dist/{chunk-ENNB4GTT.js → chunk-R65NNSSK.js} +5 -5
- package/dist/chunk-R65NNSSK.js.map +1 -0
- package/dist/helpers/code-builder.d.cts +1 -1
- package/dist/helpers/code-builder.d.ts +1 -1
- package/dist/helpers/reducer.d.cts +1 -1
- package/dist/helpers/reducer.d.ts +1 -1
- package/dist/{index-d5b13104.d.ts → index-BRpINGne.d.cts} +5 -5
- package/dist/{index-09744b29.d.ts → index-D_ySc8Oi.d.ts} +5 -5
- package/dist/index.cjs +31 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +29 -18
- package/dist/index.js.map +1 -1
- package/dist/targets/index.cjs +4 -4
- package/dist/targets/index.cjs.map +1 -1
- package/dist/targets/index.d.cts +1 -1
- package/dist/targets/index.d.ts +1 -1
- package/dist/targets/index.js +1 -1
- package/package.json +10 -11
- package/dist/chunk-ENNB4GTT.js.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2024 ReadMe (https://readme.com)
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ _Required_ Type: `object`
|
|
|
25
25
|
The [HAR](http://www.softwareishard.com/blog/har-12-spec/#request) request object to generate a snippet for.
|
|
26
26
|
|
|
27
27
|
```ts
|
|
28
|
-
import { HTTPSnippet } from 'httpsnippet';
|
|
28
|
+
import { HTTPSnippet } from '@readme/httpsnippet';
|
|
29
29
|
|
|
30
30
|
const snippet = new HTTPSnippet({
|
|
31
31
|
method: 'GET',
|
|
@@ -56,7 +56,7 @@ Type: `object`
|
|
|
56
56
|
Target options, _see [wiki](https://github.com/Kong/httpsnippet/wiki/Targets) for details_
|
|
57
57
|
|
|
58
58
|
```ts
|
|
59
|
-
import { HTTPSnippet } from 'httpsnippet';
|
|
59
|
+
import { HTTPSnippet } from '@readme/httpsnippet';
|
|
60
60
|
|
|
61
61
|
const snippet = new HTTPSnippet({
|
|
62
62
|
method: 'GET',
|
|
@@ -64,11 +64,11 @@ const snippet = new HTTPSnippet({
|
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
// generate Node.js: Native output
|
|
67
|
-
console.log(
|
|
67
|
+
console.log(snippet.convert('node'));
|
|
68
68
|
|
|
69
69
|
// generate Node.js: Native output, indent with tabs
|
|
70
70
|
console.log(
|
|
71
|
-
|
|
71
|
+
snippet.convert('node', {
|
|
72
72
|
indent: '\t',
|
|
73
73
|
}),
|
|
74
74
|
);
|
|
@@ -95,7 +95,7 @@ Type: `object`
|
|
|
95
95
|
Target options, _see [wiki](https://github.com/Kong/httpsnippet/wiki/Targets) for details_
|
|
96
96
|
|
|
97
97
|
```ts
|
|
98
|
-
import { HTTPSnippet } from 'httpsnippet';
|
|
98
|
+
import { HTTPSnippet } from '@readme/httpsnippet';
|
|
99
99
|
|
|
100
100
|
const snippet = new HTTPSnippet({
|
|
101
101
|
method: 'GET',
|
|
@@ -104,13 +104,13 @@ const snippet = new HTTPSnippet({
|
|
|
104
104
|
|
|
105
105
|
// generate Shell: cURL output
|
|
106
106
|
console.log(
|
|
107
|
-
|
|
107
|
+
snippet.convert('shell', 'curl', {
|
|
108
108
|
indent: '\t',
|
|
109
109
|
}),
|
|
110
110
|
);
|
|
111
111
|
|
|
112
112
|
// generate Node.js: Unirest output
|
|
113
|
-
console.log(
|
|
113
|
+
console.log(snippet.convert('node', 'unirest'));
|
|
114
114
|
```
|
|
115
115
|
|
|
116
116
|
### addTarget(target)
|
|
@@ -2948,11 +2948,11 @@ ${indent}` : " "
|
|
|
2948
2948
|
postData.params?.forEach((param) => {
|
|
2949
2949
|
let post = "";
|
|
2950
2950
|
if (param.fileName) {
|
|
2951
|
-
post = `${param.name}
|
|
2951
|
+
post = `${param.name}='@${param.fileName}'`;
|
|
2952
2952
|
} else {
|
|
2953
|
-
post = `${param.name}=${param.value}
|
|
2953
|
+
post = quote(`${param.name}=${param.value}`);
|
|
2954
2954
|
}
|
|
2955
|
-
push(`${arg("form")} ${
|
|
2955
|
+
push(`${arg("form")} ${post}`);
|
|
2956
2956
|
});
|
|
2957
2957
|
break;
|
|
2958
2958
|
case "application/x-www-form-urlencoded":
|
|
@@ -2962,7 +2962,7 @@ ${indent}` : " "
|
|
|
2962
2962
|
const encoded = encodeURIComponent(param.name);
|
|
2963
2963
|
const needsEncoding = encoded !== unencoded;
|
|
2964
2964
|
const name = needsEncoding ? encoded : unencoded;
|
|
2965
|
-
const flag = binary ? "--data-binary" :
|
|
2965
|
+
const flag = binary ? "--data-binary" : needsEncoding ? "--data-urlencode" : arg("data");
|
|
2966
2966
|
push(`${flag} ${quote(`${name}=${param.value}`)}`);
|
|
2967
2967
|
});
|
|
2968
2968
|
} else {
|
|
@@ -3452,4 +3452,4 @@ var addTargetClient = (targetId, client) => {
|
|
|
3452
3452
|
|
|
3453
3453
|
export { addClientPlugin, addTarget, addTargetClient, getHeaderName, isClient, isTarget, targets };
|
|
3454
3454
|
//# sourceMappingURL=out.js.map
|
|
3455
|
-
//# sourceMappingURL=chunk-
|
|
3455
|
+
//# sourceMappingURL=chunk-R65NNSSK.js.map
|