codestates / codestates/ThereWeather

[๐Ÿ‘พ Error Handling] Error [ERR_HTTP_HEADERS_SENT]: Cannot remove headers after they are sent to the client

Open
#121 0 comments 0 reactions 0 assignees View on GitHub
error
Dominant language
JavaScript
Stars
0
Forks
3
PR merge metrics
No merged PRs in 30d

Description

## ์–ด๋–ค ์—๋Ÿฌ์ธ๊ฐ€์š”?
- ๊ธฐ์ƒ์ฒญ api๋ฅผ ๋ธŒ๋ผ์šฐ์ €์— ์—ฐ๊ฒฐ์‹œํ‚ฌ ๋•Œ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒ

## ์—๋Ÿฌ ๋ฉ”์‹œ์ง€
```jsx
Error [ERR_HTTP_HEADERS_SENT]: Cannot remove headers after they are sent to the client
at new NodeError (node:internal/errors:371:5)
at ServerResponse.removeHeader (node:_http_outgoing:654:11)
at ServerResponse.send (/Users/seonhwa/Desktop/codestates31/ThereWeather/server/node_modules/express/lib/response.js:210:10)
at /Users/seonhwa/Desktop/codestates31/ThereWeather/server/index.js:61:13
at weather (/Users/seonhwa/Desktop/codestates31/ThereWeather/server/controllers/get/weather.js:64:9)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async /Users/seonhwa/Desktop/codestates31/ThereWeather/server/index.js:57:5 {
code: 'ERR_HTTP_HEADERS_SENT'
}
```

## ์—๋Ÿฌ ํ•ธ๋“ค๋ง ๋ฐฉ๋ฒ•
```jsx
server/index.js์—์„œ ์ฝœ๋ฐฑ์— ์“ด if๋ฌธ์— else๋ฌธ์„ ์ฒ˜๋ฆฌํ•˜์ง€ ์•Š์•„ ์ƒ๊ฒผ๋˜ ๊ฒƒ์œผ๋กœ ์ถ”์ธกํ•˜๊ณ  ์ˆ˜์ •ํ•จ
```

## ์—๋Ÿฌ ํ•ธ๋“ค๋ง์„ ์œ„ํ•ด ์ฐธ๊ณ ํ•œ ๋ ˆํผ๋Ÿฐ์Šค ๋งํฌ
[์˜ˆ์‹œ1](https://cocoon1787.tistory.com/714)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.