DEV Community

Discussion on: HTTP request with ES6 tagged templates

vaheqelyan profile image
Vahe Author • Edited on

But what about this

post`${{apiKey: config.apiKey}} --content-json --accept-json`

Perhaps we can include both examples?

kenbellows profile image
Ken Bellows

All depends on how complex you want your parser to be, I guess. Personally I'm not sold on a shell-command-like format, especially considering that it would be kind of annoying to build that string in JS I think. Would you specify just certain header options that can be specified with this shorthand?

I personally like the Header-Name: header-value syntax because it's very easy to parse into an Object, and its very easy to serialize an Object into that format. But it's all subjective; it's just a prototype, right? Have fun with it, try it out, use it for a project, see what you like and dislike

Thread Thread
vaheqelyan profile image
Vahe Author

I agree with you