@readme/httpsnippet 5.0.0 → 5.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.
@@ -50,6 +50,9 @@ exports.curl = {
50
50
  var fullUrl = _a.fullUrl, method = _a.method, httpVersion = _a.httpVersion, headersObj = _a.headersObj, allHeaders = _a.allHeaders, postData = _a.postData;
51
51
  if (options === void 0) { options = {}; }
52
52
  var _c = options.indent, indent = _c === void 0 ? ' ' : _c, _d = options.short, short = _d === void 0 ? false : _d, _e = options.binary, binary = _e === void 0 ? false : _e, _f = options.globOff, globOff = _f === void 0 ? false : _f, _g = options.escapeBrackets, escapeBrackets = _g === void 0 ? false : _g;
53
+ // In the interest of having nicer looking snippets JSON should be indented separately from the
54
+ // main command argument indentation.
55
+ var indentJSON = ' ';
53
56
  var _h = new code_builder_1.CodeBuilder(__assign(__assign({}, (typeof indent === 'string' ? { indent: indent } : {})), { join: indent !== false ? " \\\n".concat(indent) : ' ' })), push = _h.push, join = _h.join;
54
57
  var arg = getArg(short);
55
58
  var formattedUrl = (0, shell_1.quote)(fullUrl);
@@ -141,10 +144,10 @@ exports.curl = {
141
144
  // Basically this boils down to `--data @- <<EOF...EOF` vs `--data '...'`.
142
145
  builtPayload = true;
143
146
  if (postData.text.indexOf("'") > 0) {
144
- push("".concat(binary ? '--data-binary' : arg('data'), " @- <<EOF\n").concat(JSON.stringify(jsonPayload, null, indent || ' '), "\nEOF"));
147
+ push("".concat(binary ? '--data-binary' : arg('data'), " @- <<EOF\n").concat(JSON.stringify(jsonPayload, null, indentJSON), "\nEOF"));
145
148
  }
146
149
  else {
147
- push("".concat(binary ? '--data-binary' : arg('data'), " '\n").concat(JSON.stringify(jsonPayload, null, indent || ' '), "\n'"));
150
+ push("".concat(binary ? '--data-binary' : arg('data'), " '\n").concat(JSON.stringify(jsonPayload, null, indentJSON), "\n'"));
148
151
  }
149
152
  }
150
153
  catch (err) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.0.0",
2
+ "version": "5.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,22 +57,21 @@
57
57
  "test": "jest --coverage"
58
58
  },
59
59
  "devDependencies": {
60
- "@readme/eslint-config": "^10.3.2",
61
- "@types/eslint": "^8.4.1",
60
+ "@readme/eslint-config": "^10.5.1",
61
+ "@types/eslint": "^8.21.1",
62
62
  "@types/event-stream": "^4.0.0",
63
63
  "@types/har-format": "^1.2.8",
64
64
  "@types/jest": "^28.1.6",
65
- "@types/node": "^18.11.18",
65
+ "@types/node": "^18.14.4",
66
66
  "@types/qs": "^6.9.7",
67
67
  "@types/stringify-object": "^4.0.2",
68
- "eslint": "^8.31.0",
69
- "glob": "^8.0.1",
68
+ "eslint": "^8.35.0",
70
69
  "jest": "^28.0.3",
71
- "prettier": "^2.8.1",
70
+ "prettier": "^2.8.4",
72
71
  "require-directory": "^2.1.1",
73
72
  "ts-jest": "^28.0.5",
74
- "type-fest": "^3.5.0",
75
- "typescript": "^4.9.4"
73
+ "type-fest": "^3.6.1",
74
+ "typescript": "^4.9.5"
76
75
  },
77
76
  "dependencies": {
78
77
  "event-stream": "4.0.1",