Skip to content

Modify curlify through the Plugin system? #4143

Open
@lcofre

Description

@lcofre

First of all I would like to particularly thank you for the well thought design. In particular the Plugin System is really simple and a clever way to provide customization.

Explaining my issue, for a problematic endpoint on my definition I have to send multi-line text/plain on the body. In the code, curlify.js sanitizes the body removing newlines:

if ( request.get("body") ){
    if(type === "multipart/form-data" && request.get("method") === "POST") {
      // ...
    } else {
      curlified.push( "-d" )
      curlified.push( JSON.stringify( request.get("body") ).replace(/\\n/g, "") )
    }
}

But I would like to send the body as is and add "$" for curl to process it properly:

if ( request.get("body") ){
    if(type === "multipart/form-data" && request.get("method") === "POST") {
      // ...
    } else {
      curlified.push( "-d" )
      if(type === "text/plain") {
        curlified.push( "$" )
        curlified.push( request.get("body") )
      } else
        curlified.push( JSON.stringify( request.get("body") ).replace(/\\n/g, "") )
    }
}

@shockey
Can I achieve this through the plugin system? Or maybe the change qualifies as a pull-request?

Thanks in advance for your care and patience!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions