Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

to generate client code from httpsnippet(npm)

New member
Joined
Feb 2, 2023
Messages
2
I am not able to get headers in the output while generating the client code

Code:
const snippet = new HTTPSnippet({
method: 'GET',
url: 'http://mockbin.com/request',
headers: {
'content-type': 'Application/json',
}
});

const options = { indent: '\t' };
const output = snippet.convert('shell', 'curl', options);
console.log(output);

output

Code:
[Error [HARError]: validation failed] {
  errors: [
    {
      keyword: 'type',
      dataPath: '.headers',
      schemaPath: '#/properties/headers/type',
      params: { type: 'array' },
      message: 'should be array'
    }
  ]
}

expected: - headers should be the part of the curl rather than this error
 
Top