the-front-end-knowledge-you-may-not-know
the-front-end-knowledge-you-may-not-know copied to clipboard
用fetch在控制台测试接口
模拟post方法进行测试,不一定总是要用postMan呢
fetch(apiUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({q: 1})
}).then(async res => console.log(await res.json()))
这个知识不冷吧,感觉也不实用,操作起来太麻烦,可以加到 snippets 里面。
路过,补充一点

补充下。
