@readme/httpsnippet 4.0.4 → 4.1.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/dist/helpers/har-validator.js +0 -11
- package/dist/index.d.ts +3 -3
- package/dist/index.js +7 -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/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 +2 -2
- package/package.json +5 -5
|
@@ -69,17 +69,6 @@ var validateHarRequest = function (request) {
|
|
|
69
69
|
}
|
|
70
70
|
var valid = validate(request);
|
|
71
71
|
if (!valid && validate.errors) {
|
|
72
|
-
if (validate.errors.length === 1) {
|
|
73
|
-
// While not ideal, or compliant with the HAR spec, if we have an empty `postData` object in
|
|
74
|
-
// our HAR and no other errors we should let this through because it's fine and our client
|
|
75
|
-
// targets are able to handle it okay.
|
|
76
|
-
var error = validate.errors[0];
|
|
77
|
-
if (error.dataPath === '.postData' &&
|
|
78
|
-
error.message === "should have required property 'mimeType'" &&
|
|
79
|
-
JSON.stringify(request.postData) === '{}') {
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
72
|
throw new HARError(validate.errors);
|
|
84
73
|
}
|
|
85
74
|
return true;
|
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.
|
|
@@ -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) {
|
|
@@ -275,6 +275,10 @@ var HTTPSnippet = /** @class */ (function () {
|
|
|
275
275
|
var req = __assign({ bodySize: 0, headersSize: 0, headers: [], cookies: [], httpVersion: 'HTTP/1.1', queryString: [], postData: {
|
|
276
276
|
mimeType: ((_b = request.postData) === null || _b === void 0 ? void 0 : _b.mimeType) || 'application/octet-stream'
|
|
277
277
|
} }, request);
|
|
278
|
+
// Per the HAR spec `mimeType` needs to always be present if we have a `postData` object.
|
|
279
|
+
if (req.postData && !req.postData.mimeType) {
|
|
280
|
+
req.postData.mimeType = 'application/octet-stream';
|
|
281
|
+
}
|
|
278
282
|
if ((0, har_validator_1.validateHarRequest)(req)) {
|
|
279
283
|
_this.requests.push(_this.prepare(req, options));
|
|
280
284
|
}
|
|
@@ -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,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,6 +1,6 @@
|
|
|
1
|
-
import type { Merge } from 'type-fest';
|
|
2
|
-
import type { CodeBuilderOptions } from '../helpers/code-builder';
|
|
3
1
|
import type { Request } from '..';
|
|
2
|
+
import type { CodeBuilderOptions } from '../helpers/code-builder';
|
|
3
|
+
import type { Merge } from 'type-fest';
|
|
4
4
|
export declare type TargetId = keyof typeof targets;
|
|
5
5
|
export declare type ClientId = string;
|
|
6
6
|
export interface ClientInfo {
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.0
|
|
2
|
+
"version": "4.1.0",
|
|
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": {
|