AstronomyAPI/Samples

API not recieving request properly

Closed this issue · 1 comments

Hello, i was working on an app a while ago and the API was functional as it should but I booted up the webapp and now the API is not reacieving the req body and its giving a 422 error even tho the required things are there.

My req:
const urlLcl = 'https://api.astronomyapi.com/api/v2/studio/star-chart';
const starsRes = await fetch(urlLcl, {
method: "POST",
headers: {
"Authorization": Basic ${authString}
},
body: JSON.stringify({
"style": "navy",
"observer": {
"latitude": position.lat,
"longitude": position.lng,
"date": formattedDate
},
"view": {
"type": "constellation",
"parameters": {
"constellation": "ori"
}
}
})
})

The response:
Screenshot from 2024-01-14 15-05-23

nvm fixed it the content type header was missing