We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 07a20ae commit ed737b1Copy full SHA for ed737b1
examples/index.html
@@ -49,8 +49,18 @@ <h2 tabindex="-1" id="success2" class="success" hidden>Your submission was succe
49
let focusedInput
50
const nativeFetch = window.fetch
51
const fakeFetch = function (_, options) {
52
- const path = `https://httpbin.org/status/${options.body.get('value') === '422' ? '422' : '200'}`
53
- return nativeFetch(path, options)
+ if (options.body.get('value') === '422') {
+ return Promise.resolve(
54
+ new Response(JSON.stringify({message: '422'}), {
55
+ status: 422,
56
+ }),
57
+ )
58
+ }
59
60
+ new Response(JSON.stringify({message: 'success'}), {
61
+ status: 200,
62
63
64
}
65
window.fetch = fakeFetch
66
0 commit comments