Questions
The following questions will test our knowledge of what we have just learned:
- What is wrong with the following HTTP
POST
request using thefetch
function?fetch('http://localhost:17525/api/person', { method: 'post', headers: { 'Content-Type': 'application/json', }, body: { firstName: 'Fred' surname: 'Smith' } })
- What is wrong with the following request using the
fetch
function?const res = await fetch('http://localhost:17525/api/person/1'); console.log('firstName', res.body.firstName);
- What is wrong with the following request using the
fetch
function?fetch('http://localhost:17525/api/person/21312') .then(res => res.json()) .catch(res => { if ...