
Product
Introducing Socket Scanning for VS Code Marketplace Extensions
Socket now scans VS Code extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.
igroot-fetch
Advanced tools
在基于 iGroot 构建的项目中发送 fetch 请求,有 restful 和 graphql 两种请求发送方式
npm install --save igroot-fetch
或者
bower install igroot-fetch
或者
yarn add igroot-fetch
const BsFetch = require('igroot-fetch')
或者
import BsFetch from('igroot-fetch')
BsFetch(url).get().then(res=>{
console.log(res)
})
若有get参数:
const params={
name:'fanyizhen',
gender:'female'
}
BsFetch(url).get(params).then(res=>{
console.log(res)
})
const postBody={
name:'fanyizhen',
gender:'female'
}
BsFetch(url).post(postBody).then(res=>{
console.log(res)
})
BsFetch(url).query(`
{
users{
id
name
}
}`).then(res => {
console.log(res)
})
const graphqlApi = BsFetch(url)
const updateResult = graphqlApi.createFragment(`
fragment on UpdateResult {
value
}
`)
graphqlApi.mutate(`
{
update_user(
id:5,
apps:[1,4,5]
){
...${updateResult}
}
}
`).then(res => {
console.log(res)
})
为 BsFetch 添加第二个参数:
{
credentials: true||false(设置发送请求时是否携带cookie)
}
为 BsFetch 添加第二个参数:
{
headers: {
Authorization: 'Bearer xxxxxx',
}
}
发送一个 graphql 的 query 请求,需要携带 cookie ,并在请求头中设置 jwt_token:
BsFetch(APP_CONFIG.default.apiDomain + '/graphql',{
headers: {
Authorization: 'Bearer ' + (!!(window.localStorage['jwtToken']) ? (window.localStorage['jwtToken']) : '')
},
credentials: true
}
).query(`
{
users{
id
name
}
}`).then(res => {
console.log(res)
})
FAQs
iGroot 应用 API 层
The npm package igroot-fetch receives a total of 21 weekly downloads. As such, igroot-fetch popularity was classified as not popular.
We found that igroot-fetch 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.

Product
Socket now scans VS Code extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.

Research
/Security News
Socket uncovered two malicious VS Code themes in a GlassWorm-linked cluster with thousands of installs across VS Code Marketplace and Open VSX.

Security News
/Company News
Capital One is partnering with Socket to proactively secure its open source supply chain.