'how to send plain text data in fetch and get json type data in react native

fetch('http://3.108.170.236/erp/apis/login_otp.php', {
  method: 'POST',
  headers: {
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    monumber: '8770276989',
  }),
})
  .then(async response => {
    console.log('fetching api');
    console.log(await response.json());
    return await response.json();
  })
  
  .catch(err => {
    console.log('fetch error' + err);
  });

postman api output

[{"otp_value":665354,"student_id":"3117"}]

getting error of 405 method not allowed. i am sending data in post format with plain text and api response is in json what should i do get proper value.

Thanking you advance community.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source