hoppscotch / hopp-cli

šŸ¤– HTTP CLI client for https://hoppscotch.io
https://hoppscotch.io
MIT License
176 stars 24 forks source link

`headers` schema change #19

Closed bytesnz closed 4 years ago

bytesnz commented 4 years ago

The headers schema seems to be different between hoppscotch.io and the hopp-cli. The CLI is expecting an array of strings, but hoppscotch.io produces an array of key/value objects. An example of an exported collection is below.

[
  {
    "name": "My Collection",
    "folders": [],
    "requests": [
      {
        "url": "https://httpbin.org",
        "path": "/get",
        "method": "GET",
        "auth": "None",
        "httpUser": "",
        "httpPassword": "",
        "passwordFieldType": "password",
        "bearerToken": "",
        "headers": [
          {
            "key": "My-Header",
            "value": "hello"
          }
        ],
        "params": [],
        "bodyParams": [],
        "rawParams": "",
        "rawInput": true,
        "contentType": "",
        "requestType": "",
        "preRequestScript": "// pw.env.set('variable', 'value');",
        "testScript": "// pw.expect('variable').toBe('value');",
        "label": "Test",
        "name": "Test",
        "collection": 0
      }
    ]
  }
]
athul commented 4 years ago

Hey @bytesnz, Sorry for the late reply.

This was an easy fix and I had fixed it. But seeing that code after about 6 months made me understand the noob who wrote it(that's me) and the šŸ¤® code I had written then. Plus there has been a number of additions to the HoppScotch project itself and I was out of the loop these time. The code wasn't even commented so I'm making sure I document these stuff šŸ˜„

I'm working on a rewrite of the send method for a faster version. Please bear with me on this, possibly I'll try to complete this in the coming days.

bytesnz commented 4 years ago

Hey @athul, no worries. Figured it would be an easy fix. Was thinking about trying to fix it myself, but haven't touched go.

Thanks for all your work - it is a super helpful tool.

athul commented 4 years ago

Closed with #21