@readme/httpsnippet 4.0.5 → 4.1.1
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/dist/helpers/code-builder.d.ts +1 -1
- package/dist/helpers/form-data.js +1 -1
- package/dist/helpers/headers.d.ts +1 -1
- package/dist/helpers/reducer.d.ts +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +3 -3
- package/dist/targets/clojure/clj_http/client.js +0 -9
- package/dist/targets/go/native/client.js +0 -9
- package/dist/targets/http/http1.1/client.js +0 -10
- package/dist/targets/java/asynchttp/client.js +0 -9
- package/dist/targets/java/nethttp/client.js +0 -9
- package/dist/targets/java/okhttp/client.js +0 -9
- package/dist/targets/java/unirest/client.js +0 -9
- package/dist/targets/javascript/axios/client.js +0 -9
- package/dist/targets/javascript/fetch/client.js +0 -9
- package/dist/targets/javascript/jquery/client.js +0 -9
- package/dist/targets/javascript/xhr/client.js +0 -9
- package/dist/targets/kotlin/okhttp/client.js +0 -9
- package/dist/targets/node/axios/client.js +1 -10
- package/dist/targets/node/axios/fixtures/application-form-encoded.js +1 -1
- package/dist/targets/node/axios/fixtures/application-json.js +1 -1
- package/dist/targets/node/axios/fixtures/cookies.js +1 -1
- package/dist/targets/node/axios/fixtures/custom-method.js +1 -1
- package/dist/targets/node/axios/fixtures/full.js +1 -1
- package/dist/targets/node/axios/fixtures/headers.js +1 -1
- package/dist/targets/node/axios/fixtures/http-insecure.js +1 -1
- package/dist/targets/node/axios/fixtures/jsonObj-multiline.js +1 -1
- package/dist/targets/node/axios/fixtures/jsonObj-null-value.js +1 -1
- package/dist/targets/node/axios/fixtures/multipart-data.js +1 -1
- package/dist/targets/node/axios/fixtures/multipart-file.js +1 -1
- package/dist/targets/node/axios/fixtures/multipart-form-data-no-params.js +1 -1
- package/dist/targets/node/axios/fixtures/multipart-form-data.js +1 -1
- package/dist/targets/node/axios/fixtures/nested.js +1 -1
- package/dist/targets/node/axios/fixtures/postdata-malformed.js +1 -1
- package/dist/targets/node/axios/fixtures/query-encoded.js +1 -1
- package/dist/targets/node/axios/fixtures/query.js +1 -1
- package/dist/targets/node/axios/fixtures/short.js +1 -1
- package/dist/targets/node/axios/fixtures/text-plain.js +1 -1
- package/dist/targets/node/fetch/client.js +0 -9
- package/dist/targets/node/native/client.js +0 -9
- package/dist/targets/node/request/client.js +0 -9
- package/dist/targets/node/unirest/client.js +0 -9
- package/dist/targets/objc/nsurlsession/client.js +0 -9
- package/dist/targets/ocaml/cohttp/client.js +0 -9
- package/dist/targets/php/curl/client.js +0 -9
- package/dist/targets/php/guzzle/client.js +0 -9
- package/dist/targets/php/http1/client.js +0 -9
- package/dist/targets/php/http2/client.js +0 -9
- package/dist/targets/powershell/common.d.ts +1 -1
- package/dist/targets/python/requests/client.js +11 -11
- package/dist/targets/r/httr/client.js +0 -9
- package/dist/targets/shell/curl/client.js +0 -10
- package/dist/targets/shell/httpie/client.js +0 -9
- package/dist/targets/shell/wget/client.js +0 -9
- package/dist/targets/swift/nsurlsession/client.js +0 -9
- package/dist/targets/targets.d.ts +6 -6
- package/package.json +5 -5
|
@@ -32,7 +32,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
32
32
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
33
33
|
function step(op) {
|
|
34
34
|
if (f) throw new TypeError("Generator is already executing.");
|
|
35
|
-
while (_) try {
|
|
35
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
36
36
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
37
37
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
38
38
|
switch (op[0]) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type { Param, PostDataCommon, Request as NpmHarRequest } from 'har-format';
|
|
3
|
-
import type { UrlWithParsedQuery } from 'url';
|
|
4
2
|
import type { ReducedHelperObject } from './helpers/reducer';
|
|
5
3
|
import type { ClientId, TargetId } from './targets/targets';
|
|
4
|
+
import type { Param, PostDataCommon, Request as NpmHarRequest } from 'har-format';
|
|
5
|
+
import type { UrlWithParsedQuery } from 'url';
|
|
6
6
|
export { availableTargets, extname } from './helpers/utils';
|
|
7
7
|
export { addTarget, addTargetClient } from './targets/targets';
|
|
8
8
|
/** is this wrong? yes. according to the spec (http://www.softwareishard.com/blog/har-12-spec/#postData) it's technically wrong since `params` and `text` are (by the spec) mutually exclusive. However, in practice, this is not what is often the case.
|
|
@@ -11,11 +11,11 @@ export { addTarget, addTargetClient } from './targets/targets';
|
|
|
11
11
|
*
|
|
12
12
|
* Then, in addition to that, it really adds to complexity with TypeScript (TypeScript takes this constraint very very seriously) in a way that's not actually super useful. So, we treat this object as though it could have both or either of `params` and/or `text`.
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
type PostDataBase = PostDataCommon & {
|
|
15
15
|
text?: string;
|
|
16
16
|
params?: Param[];
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export type HarRequest = Omit<NpmHarRequest, 'postData'> & {
|
|
19
19
|
postData: PostDataBase;
|
|
20
20
|
};
|
|
21
21
|
export interface RequestExtras {
|
|
@@ -31,7 +31,7 @@ export interface RequestExtras {
|
|
|
31
31
|
cookiesObj: ReducedHelperObject;
|
|
32
32
|
allHeaders: ReducedHelperObject;
|
|
33
33
|
}
|
|
34
|
-
export
|
|
34
|
+
export type Request = HarRequest & RequestExtras;
|
|
35
35
|
interface Entry {
|
|
36
36
|
request: Partial<HarRequest>;
|
|
37
37
|
}
|
|
@@ -71,7 +71,6 @@ export declare class HTTPSnippet {
|
|
|
71
71
|
slashes: boolean | null;
|
|
72
72
|
port: string | null;
|
|
73
73
|
};
|
|
74
|
-
comment?: string | undefined;
|
|
75
74
|
method: string;
|
|
76
75
|
httpVersion: string;
|
|
77
76
|
cookies: import("har-format").Cookie[];
|
|
@@ -79,6 +78,7 @@ export declare class HTTPSnippet {
|
|
|
79
78
|
queryString: import("har-format").QueryString[];
|
|
80
79
|
headersSize: number;
|
|
81
80
|
bodySize: number;
|
|
81
|
+
comment?: string | undefined;
|
|
82
82
|
postData: PostDataCommon & {
|
|
83
83
|
text?: string | undefined;
|
|
84
84
|
params?: Param[] | undefined;
|
package/dist/index.js
CHANGED
|
@@ -37,11 +37,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
exports.__esModule = true;
|
|
39
39
|
exports.HTTPSnippet = exports.addTargetClient = exports.addTarget = exports.extname = exports.availableTargets = void 0;
|
|
40
|
+
// eslint-disable-next-line node/no-deprecated-api
|
|
41
|
+
var url_1 = require("url");
|
|
40
42
|
var event_stream_1 = require("event-stream");
|
|
41
43
|
var form_data_1 = __importDefault(require("form-data"));
|
|
42
44
|
var qs_1 = require("qs");
|
|
43
|
-
// eslint-disable-next-line node/no-deprecated-api
|
|
44
|
-
var url_1 = require("url");
|
|
45
45
|
var form_data_2 = require("./helpers/form-data");
|
|
46
46
|
var har_validator_1 = require("./helpers/har-validator");
|
|
47
47
|
var headers_1 = require("./helpers/headers");
|
|
@@ -55,7 +55,7 @@ __createBinding(exports, targets_2, "addTarget");
|
|
|
55
55
|
__createBinding(exports, targets_2, "addTargetClient");
|
|
56
56
|
var DEBUG_MODE = false;
|
|
57
57
|
var debug = {
|
|
58
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function, no-console
|
|
59
59
|
info: DEBUG_MODE ? console.info : function () { }
|
|
60
60
|
};
|
|
61
61
|
var isHarEntry = function (value) {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for Clojure using clj-http.
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @tggreene
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
exports.__esModule = true;
|
|
12
3
|
exports.clj_http = void 0;
|
|
13
4
|
var code_builder_1 = require("../../../helpers/code-builder");
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for native Go.
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @montanaflynn
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
var __assign = (this && this.__assign) || function () {
|
|
12
3
|
__assign = Object.assign || function(t) {
|
|
13
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1,14 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator to generate raw HTTP/1.1 request strings,
|
|
5
|
-
* in accordance to the RFC 7230 (and RFC 7231) specifications.
|
|
6
|
-
*
|
|
7
|
-
* @author
|
|
8
|
-
* @irvinlim
|
|
9
|
-
*
|
|
10
|
-
* For any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
11
|
-
*/
|
|
12
2
|
var __assign = (this && this.__assign) || function () {
|
|
13
3
|
__assign = Object.assign || function(t) {
|
|
14
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* Asynchronous Http and WebSocket Client library for Java
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @windard
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
var __assign = (this && this.__assign) || function () {
|
|
12
3
|
__assign = Object.assign || function(t) {
|
|
13
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for Java using java.net.http.
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @wtetsu
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
var __assign = (this && this.__assign) || function () {
|
|
12
3
|
__assign = Object.assign || function(t) {
|
|
13
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for Java using OkHttp.
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @shashiranjan84
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
var __assign = (this && this.__assign) || function () {
|
|
12
3
|
__assign = Object.assign || function(t) {
|
|
13
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for Java using Unirest.
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @shashiranjan84
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
var __assign = (this && this.__assign) || function () {
|
|
12
3
|
__assign = Object.assign || function(t) {
|
|
13
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for Javascript & Node.js using Axios.
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @rohit-gohri
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
var __assign = (this && this.__assign) || function () {
|
|
12
3
|
__assign = Object.assign || function(t) {
|
|
13
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for fetch
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @pmdroid
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
var __assign = (this && this.__assign) || function () {
|
|
12
3
|
__assign = Object.assign || function(t) {
|
|
13
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for native XMLHttpRequest
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @AhmadNassri
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
var __assign = (this && this.__assign) || function () {
|
|
12
3
|
__assign = Object.assign || function(t) {
|
|
13
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for native XMLHttpRequest
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @AhmadNassri
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
var __assign = (this && this.__assign) || function () {
|
|
12
3
|
__assign = Object.assign || function(t) {
|
|
13
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for Kotlin using OkHttp.
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @seanghay
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
var __assign = (this && this.__assign) || function () {
|
|
12
3
|
__assign = Object.assign || function(t) {
|
|
13
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for Javascript & Node.js using Axios.
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @rohit-gohri
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
var __assign = (this && this.__assign) || function () {
|
|
12
3
|
__assign = Object.assign || function(t) {
|
|
13
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -37,7 +28,7 @@ exports.axios = {
|
|
|
37
28
|
var method = _a.method, fullUrl = _a.fullUrl, allHeaders = _a.allHeaders, postData = _a.postData;
|
|
38
29
|
var opts = __assign({ indent: ' ' }, options);
|
|
39
30
|
var _b = new code_builder_1.CodeBuilder({ indent: opts.indent }), blank = _b.blank, join = _b.join, push = _b.push, addPostProcessor = _b.addPostProcessor;
|
|
40
|
-
push("const axios = require('axios')
|
|
31
|
+
push("const axios = require('axios');");
|
|
41
32
|
var reqOpts = {
|
|
42
33
|
method: method,
|
|
43
34
|
url: fullUrl
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for Node.js using node-fetch.
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @hirenoble
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
var __assign = (this && this.__assign) || function () {
|
|
12
3
|
__assign = Object.assign || function(t) {
|
|
13
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for native Node.js.
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @AhmadNassri
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
var __assign = (this && this.__assign) || function () {
|
|
12
3
|
__assign = Object.assign || function(t) {
|
|
13
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for Node.js using Request.
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @AhmadNassri
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
var __assign = (this && this.__assign) || function () {
|
|
12
3
|
__assign = Object.assign || function(t) {
|
|
13
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for Node.js using Unirest.
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @AhmadNassri
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
var __assign = (this && this.__assign) || function () {
|
|
12
3
|
__assign = Object.assign || function(t) {
|
|
13
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for Objective-C using NSURLSession.
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @thibaultCha
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
var __assign = (this && this.__assign) || function () {
|
|
12
3
|
__assign = Object.assign || function(t) {
|
|
13
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for OCaml using CoHTTP.
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @SGrondin
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
var __assign = (this && this.__assign) || function () {
|
|
12
3
|
__assign = Object.assign || function(t) {
|
|
13
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for PHP using curl-ext.
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @AhmadNassri
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
var __assign = (this && this.__assign) || function () {
|
|
12
3
|
__assign = Object.assign || function(t) {
|
|
13
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for PHP using Guzzle.
|
|
5
|
-
*
|
|
6
|
-
* @author @RobertoArruda
|
|
7
|
-
* @author @erunion
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
var __assign = (this && this.__assign) || function () {
|
|
12
3
|
__assign = Object.assign || function(t) {
|
|
13
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for PHP using curl-ext.
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @AhmadNassri
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
var __assign = (this && this.__assign) || function () {
|
|
12
3
|
__assign = Object.assign || function(t) {
|
|
13
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for PHP using curl-ext.
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @AhmadNassri
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
var __assign = (this && this.__assign) || function () {
|
|
12
3
|
__assign = Object.assign || function(t) {
|
|
13
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Converter } from '../targets';
|
|
2
|
-
export
|
|
2
|
+
export type PowershellCommand = 'Invoke-RestMethod' | 'Invoke-WebRequest';
|
|
3
3
|
export declare const generatePowershellConvert: (command: PowershellCommand) => Converter<any>;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for Python using Requests
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @montanaflynn
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
var __assign = (this && this.__assign) || function () {
|
|
12
3
|
__assign = Object.assign || function(t) {
|
|
13
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -64,7 +55,12 @@ exports.requests = {
|
|
|
64
55
|
payload = {};
|
|
65
56
|
postData.params.forEach(function (p) {
|
|
66
57
|
if (p.fileName) {
|
|
67
|
-
|
|
58
|
+
if (p.contentType) {
|
|
59
|
+
files[p.name] = "('".concat(p.fileName, "', open('").concat(p.fileName, "', 'rb'), '").concat(p.contentType, "')");
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
files[p.name] = "('".concat(p.fileName, "', open('").concat(p.fileName, "', 'rb'))");
|
|
63
|
+
}
|
|
68
64
|
hasFiles = true;
|
|
69
65
|
}
|
|
70
66
|
else {
|
|
@@ -91,7 +87,11 @@ exports.requests = {
|
|
|
91
87
|
}
|
|
92
88
|
}
|
|
93
89
|
// The `open()` call must be a literal in the code snippet.
|
|
94
|
-
addPostProcessor(function (code) {
|
|
90
|
+
addPostProcessor(function (code) {
|
|
91
|
+
return code
|
|
92
|
+
.replace(/"\('(.+)', open\('(.+)', 'rb'\)\)"/g, '("$1", open("$2", "rb"))')
|
|
93
|
+
.replace(/"\('(.+)', open\('(.+)', 'rb'\), '(.+)'\)"/g, '("$1", open("$2", "rb"), "$3")');
|
|
94
|
+
});
|
|
95
95
|
break;
|
|
96
96
|
default: {
|
|
97
97
|
var stringPayload = JSON.stringify(postData.text);
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for R using httr
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @gabrielakoreeda
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
exports.__esModule = true;
|
|
12
3
|
exports.httr = void 0;
|
|
13
4
|
var code_builder_1 = require("../../../helpers/code-builder");
|
|
@@ -1,14 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
*
|
|
5
|
-
* HTTP code snippet generator for the Shell using cURL.
|
|
6
|
-
*
|
|
7
|
-
* @author
|
|
8
|
-
* @AhmadNassri
|
|
9
|
-
*
|
|
10
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
11
|
-
*/
|
|
12
2
|
var __assign = (this && this.__assign) || function () {
|
|
13
3
|
__assign = Object.assign || function(t) {
|
|
14
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for the Shell using HTTPie.
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @AhmadNassri
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
var __assign = (this && this.__assign) || function () {
|
|
12
3
|
__assign = Object.assign || function(t) {
|
|
13
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for the Shell using Wget.
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @AhmadNassri
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
var __assign = (this && this.__assign) || function () {
|
|
12
3
|
__assign = Object.assign || function(t) {
|
|
13
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* HTTP code snippet generator for Swift using NSURLSession.
|
|
5
|
-
*
|
|
6
|
-
* @author
|
|
7
|
-
* @thibaultCha
|
|
8
|
-
*
|
|
9
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
10
|
-
*/
|
|
11
2
|
var __assign = (this && this.__assign) || function () {
|
|
12
3
|
__assign = Object.assign || function(t) {
|
|
13
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import type { Merge } from 'type-fest';
|
|
2
|
-
import type { CodeBuilderOptions } from '../helpers/code-builder';
|
|
3
1
|
import type { Request } from '..';
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import type { CodeBuilderOptions } from '../helpers/code-builder';
|
|
3
|
+
import type { Merge } from 'type-fest';
|
|
4
|
+
export type TargetId = keyof typeof targets;
|
|
5
|
+
export type ClientId = string;
|
|
6
6
|
export interface ClientInfo {
|
|
7
7
|
key: ClientId;
|
|
8
8
|
title: string;
|
|
9
9
|
link: string;
|
|
10
10
|
description: string;
|
|
11
11
|
}
|
|
12
|
-
export
|
|
12
|
+
export type Converter<T extends Record<string, any>> = (request: Request, options?: Merge<CodeBuilderOptions, T>) => string;
|
|
13
13
|
export interface Client<T extends Record<string, any> = Record<string, any>> {
|
|
14
14
|
info: ClientInfo;
|
|
15
15
|
convert: Converter<T>;
|
|
16
16
|
}
|
|
17
|
-
export
|
|
17
|
+
export type Extension = `.${string}` | null;
|
|
18
18
|
export interface TargetInfo {
|
|
19
19
|
key: TargetId;
|
|
20
20
|
title: string;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.
|
|
2
|
+
"version": "4.1.1",
|
|
3
3
|
"name": "@readme/httpsnippet",
|
|
4
4
|
"description": "HTTP Request snippet generator for *most* languages",
|
|
5
5
|
"homepage": "https://github.com/readmeio/httpsnippet",
|
|
@@ -57,12 +57,12 @@
|
|
|
57
57
|
"test": "jest --coverage"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@readme/eslint-config": "^
|
|
60
|
+
"@readme/eslint-config": "^10.1.0",
|
|
61
61
|
"@types/eslint": "^8.4.1",
|
|
62
62
|
"@types/event-stream": "^4.0.0",
|
|
63
63
|
"@types/har-format": "^1.2.8",
|
|
64
|
-
"@types/jest": "^
|
|
65
|
-
"@types/node": "^
|
|
64
|
+
"@types/jest": "^28.1.6",
|
|
65
|
+
"@types/node": "^18.6.3",
|
|
66
66
|
"@types/qs": "^6.9.7",
|
|
67
67
|
"@types/stringify-object": "^4.0.1",
|
|
68
68
|
"eslint": "^8.19.0",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"prettier": "^2.7.1",
|
|
72
72
|
"require-directory": "^2.1.1",
|
|
73
73
|
"ts-jest": "^28.0.5",
|
|
74
|
-
"type-fest": "^
|
|
74
|
+
"type-fest": "^3.0.0",
|
|
75
75
|
"typescript": "^4.6.3"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|