Skip to content

objc:nsurlsession target does not seem to support boolean values in postData payload #65

@thboileau

Description

@thboileau

Hello,

I set my HAR request as follow:

{
  "headers": [
    {
      "name": "Host",
      "value": "example.com"
    },
    {
      "name": "Accept",
      "value": "application/json"
    },
    {
      "name": "Content-Type",
      "value": "application/json"
    }
  ],
  "bodySize": 160,
  "postData": {
    "text": "{\n  \"active\" : false\n}",
    "mimeType": "application/json"
  },
  "httpVersion": "HTTPS/1.1",
  "method": "POST",
  "url": "https://example.com/sample/"
}

Then I launch the following command line:

httpsnippet /tmp/sources/httpsnippet/test.json --target objc --client nsurlsession

I get the following exception:

/usr/local/lib/node_modules/httpsnippet/src/targets/objc/helpers.js:65
        return '@"' + value.replace(/"/g, '\\"') + '"'
                            ^
TypeError: Object false has no method 'replace'
    at Object.module.exports.literalRepresentation (/usr/local/lib/node_modules/httpsnippet/src/targets/objc/helpers.js:65:29)
    at Object.module.exports.literalRepresentation (/usr/local/lib/node_modules/httpsnippet/src/targets/objc/helpers.js:61:63)
    at Object.module.exports.nsDeclaration (/usr/local/lib/node_modules/httpsnippet/src/targets/objc/helpers.js:37:24)
    at module.exports (/usr/local/lib/node_modules/httpsnippet/src/targets/objc/nsurlsession.js:59:29)
    at /usr/local/lib/node_modules/httpsnippet/src/index.js:200:19
    at Array.map (native)
    at HTTPSnippet.convert (/usr/local/lib/node_modules/httpsnippet/src/index.js:199:33)
    at iterator (/usr/local/lib/node_modules/httpsnippet/bin/httpsnippet:83:24)
    at /usr/local/lib/node_modules/httpsnippet/node_modules/async/lib/async.js:246:17
    at /usr/local/lib/node_modules/httpsnippet/node_modules/async/lib/async.js:122:13

Version of node.js: 0.10.32
Version of httpsnippet: 1.16.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions