$ cat "dev63.hatenablog.com/entry/2022/12/09/024323.md"
// ブログエントリー — 2022/12/9

【axios】getはOKだが、postだと415 error

getで200が返ってきた物

const res = await axios({
    method: 'get',
    url: '呼び出すAPIのURL',
    headers: { 'content-type': 'application/json' }
  })

postで415が返ってきた物

const res = await axios({
    method: 'post',
    url: '呼び出すAPIのURL',
    headers: { 'content-type': 'application/json' }
  })

postで302が返ってきたもの

const res = await axios.post('呼び出すAPIのURL', {
  headers: { 'content-type': 'application/json' }
})

参考

[https://chaika.hatenablog.com/entry/2020/07/07/080000:embed:cite]

ENTRY: dev63.hatenablog.com/entry/2022/12/09/024323.md
DATE: 2022/12/9
WORDS: 59