
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
mkp-restful-client
Advanced tools
RESTful client with javascript,Redux is supported,you could use it in all of javascript projects especially React and React Native.
$ npm install mkp-restful-client --save
//import RESTful client
import RESTfulClient from "mkp-restful-client";
//initial RESTful client
//default client is fetch
let rest=new RESTfulClient();
window.$rest=rest;
//request a json
rest.request({
url:"https://api.github.com/users/mralexgray/repos"
}).then(response=>{
console.log(response);
})
There have two client fetch and superagent , fetch is default client.
let rest=new RESTfulClient();
or
let rest=new RESTfulClient({
clientEngine:{
name:"fetch",
client:fetch
}
});
code with superagent following
import superagent from "superagent";
let rest=new RESTfulClient({
clientEngine:{
name:"superagent",
client:superagent
}
});
let rest =new RESTfulClient({
normalizeResponse(response){
//you can override response
//example
//return response.json().then(json=>{
// response.body=json;
// return response;
//});
//or
//response.data=response.body.Data;
//return response;
},
beforeSend(options, dispatch){
//you could override the opstions
//such as combine url
//options.url=host+options.url;
//do somethings
},
sending(options, xhr, dispatch){
//you could show a loading or store xhr and so on
//do somethings
},
received(options, response, xhr, dispatch){
//if show a loading at sending , you must remove that in here.
//do somethings
},
success(response, dispatch){
//how to read response header's values?
//example:
//response.header["HEADER_NAME"]
//in addtion you can read response.text , response.body and so on.
//you can inspect these property through console.
//do somethings
},
error(err, dispatch){
//do somethings
},
complete(options, dispatch){
//do somethings
}
})
the method will return a promise object.
FAQs
RESTful client
We found that mkp-restful-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.