
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
http-promise-api
Advanced tools
#http-promise-api
A simple nodejs application for http requests with Promise wrapper
npm install http-promise-api
How to use
var HttpRequestAPI = require('http-promise-api')
HttpRequestAPI = new HttpRequestAPI('your base url', {header object});
//get request
HttpRequestAPI.get('/posts').then(function(data){
//Successful
}, function(error){
//Error
})
All the required headers like Content-Type, Tokens etc.. need to be inserted while constructing HttpRequestAPI.
#Response/Error Formats
successful response
{
headers:{
//All headers from servers
},
status:{
code:200,
message:'OK'
},
data: {
//desired data
}
}
Error Response
{
headers:{ },
status: {},
error: {
//Any error responses from server
}
}
#Methods
get(resource, query)
//url will be http://example.com/?id=123
HttpRequestAPI.get('/posts', {id:'123'}).then(function(data){
//Successful
}, function(error){
//Error
})
post(resource, postbody, query)
//url will be http://example.com/
HttpRequestAPI.get('/posts', {id:'123', name:'Anand', profession:'developer'}, {optional}).then(function(data){
//Successful
}, function(error){
//Error
})
delete(resource, query, body)
//url will be http://example.com/?id='123'
HttpRequestAPI.delete('/posts', {id:'123'}, {optional -body }).then(function(data){
//Successful
}, function(error){
//Error
})
put(resource, postbody, query)
//url will be http://example.com/
HttpRequestAPI.put('/posts', {id:'123', name:'Anand', profession:'developer'}, {optional}).then(function(data){
//Successful
}, function(error){
//Error
})
#Generic Method
A part from above requests there is a generic request makeRequest(resource, method, query, body)
HttpRequestAPI.makeRequest('/posts', 'ANY METHOD', {}, {}).then(function(data){
//Successful
}, function(error){
//Error
})
FAQs
Http Requests with ES6 Promise capability
We found that http-promise-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.