0.1.1 • Published 8 years ago
superagent-case-converter v0.1.1
superagent-case-converter
Installation
$ npm i superagent-case-converter
Usage
When communicating to a REST endpoint that expects and sends out snake_case, caseConverter automatically transforms the payload from camelCase to snake_case case and the response from snake_case to camelCase.
Therefore the user has not to deal with snake_case.
import request from 'superagent'
import caseConverter from 'superagent-case-converter'
request
.post(snakeCaseEndpoint)
.send(payloadInCamelCase)
.use(caseConverter)
.end((err, res) => {
const responseInCamelCase = res.body
})