DEV Community

Discussion on: HTTP request with ES6 tagged templates

Collapse
 
vaheqelyan profile image
Vahe

In my opinion, this syntax is more valid

import {post} from 'karin'

post`https://example.com/api.createMsg?${{apiKey: config.apiKey}}
Content-Type: application/json
Accept: application/json

${{
  title: 'Test Message',
  body: 'This is a test of the messaging system.'
}}`

Thanks to Ken Bellows for the idea