해결된 질문
작성
·
406
1
post 요청시 헤더 관련 아래 에러 발생하는데, apollo-require-preflight: true등을 넣으면 정상 작동 하네요. 혹시 이 에러가 강의 중에는 안 나던데, 이유 알 수 있을까요?
{
"errors": [
{
"message": "This operation has been blocked as a potential Cross-Site Request Forgery (CSRF). Please either specify a 'content-type' header (with a type that is not one of application/x-www-form-urlencoded, multipart/form-data, text/plain) or provide a non-empty value for one of the following headers: x-apollo-operation-name, apollo-require-preflight\n",
"extensions": {
"code": "BAD_REQUEST",
"stacktrace": [
"BadRequestError: This operation has been blocked as a potential Cross-Site Request Forgery (CSRF). Please either specify a 'content-type' header (with a type that is not one of application/x-www-form-urlencoded, multipart/form-data, text/plain) or provide a non-empty value for one of the following headers: x-apollo-operation-name, apollo-require-preflight",
"",
" at new GraphQLErrorWithCode (/Users/hojeongpark/Develop/study/backend-bootcamp/class/section13/13-01-single-image-upload/node_modules/@apollo/server/src/internalErrorClasses.ts:15:5)",
" at new BadRequestError (/Users/hojeongpark/Develop/study/backend-bootcamp/class/section13/13-01-single-image-upload/node_modules/@apollo/server/src/internalErrorClasses.ts:116:5)",
" at preventCsrf (/Users/hojeongpark/Develop/study/backend-bootcamp/class/section13/13-01-single-image-upload/node_modules/@apollo/server/src/preventCsrf.ts:91:9)",
" at ApolloServer.executeHTTPGraphQLRequest (/Users/hojeongpark/Develop/study/backend-bootcamp/class/section13/13-01-single-image-upload/node_modules/@apollo/server/src/ApolloServer.ts:1047:20)",
" at processTicksAndRejections (node:internal/process/task_queues:95:5)"
]
}
}
]
}
답변 1
1