Comment

Comment by curvx

Tried just now, same error.

I don't understand one thing, how come despite getting 405, I am getting success "Thank you, please check your email!" message? Are you not checking the status (error) code before showing the message?

  {
    "message": "Request failed with status code 405",
    "name": "AxiosError",
    "stack": "AxiosError: Request failed with status code 405\n    at https://howtogetgithubstars.com/_next/static/chunks/356-dd9ab9f01a6d62a9.js:6:39972\n    at XMLHttpRequest.f (https://howtogetgithubstars.com/_next/static/chunks/356-dd9ab9f01a6d62a9.js:6:40112)",
    "config": {
        "transitional": {
            "silentJSONParsing": true,
            "forcedJSONParsing": true,
            "clarifyTimeoutError": false
        },
        "adapter": [
            "xhr",
            "http"
        ],
        "transformRequest": [
            null
        ],
        "transformResponse": [
            null
        ],
        "timeout": 0,
        "xsrfCookieName": "XSRF-TOKEN",
        "xsrfHeaderName": "X-XSRF-TOKEN",
        "maxContentLength": -1,
        "maxBodyLength": -1,
        "env": {},
        "headers": {
            "Accept": "application/json, text/plain, */*",
            "Content-Type": "application/json"
        },
        "method": "post",
        "url": "/api/newsletter",
        "data": "{\"email\":\"[email protected]\"}"
    },
    "code": "ERR_BAD_REQUEST",
    "status": 405
}
parent curvx 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton