the-front-end-knowledge-you-may-not-know icon indicating copy to clipboard operation
the-front-end-knowledge-you-may-not-know copied to clipboard

用fetch在控制台测试接口

Open chbro opened this issue 7 years ago • 3 comments

模拟post方法进行测试,不一定总是要用postMan呢

fetch(apiUrl, {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({q: 1})
}).then(async res => console.log(await res.json()))

chbro avatar Apr 13 '18 04:04 chbro

这个知识不冷吧,感觉也不实用,操作起来太麻烦,可以加到 snippets 里面。

justjavac avatar Apr 13 '18 05:04 justjavac

路过,补充一点

vanishcode avatar Aug 07 '18 14:08 vanishcode

补充下。 image

whyour avatar Feb 14 '19 07:02 whyour