Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content-Type header needs to be one as defined by IANA team #5

Open
prayagupa opened this issue Sep 20, 2019 · 0 comments
Open

Content-Type header needs to be one as defined by IANA team #5

prayagupa opened this issue Sep 20, 2019 · 0 comments

Comments

@prayagupa
Copy link
Owner

prayagupa commented Sep 20, 2019

app.get('/test', (rq, res) => {                                                                        
 res.status(200).header('Content-Type', 'rubbish').send({'data': 'test'})                              
});   
λ node app.js 
adding session
Express server listening on port 3000
GET /test 500 2.473 ms - 1769
TypeError: invalid media type
    at Object.parse (/Users/a1353612/soundofmusic/compile1010/nodejs-microservice/onlywallet-backend/node_modules/content-type/index.js:126:11)
    at setCharset (/Users/a1353612/soundofmusic/compile1010/nodejs-microservice/onlywallet-backend/node_modules/express/lib/utils.js:256:28)
    at ServerResponse.send (/Users/a1353612/soundofmusic/compile1010/nodejs-microservice/onlywallet-backend/node_modules/express/lib/response.js:170:32)
    at ServerResponse.json (/Users/a1353612/soundofmusic/compile1010/nodejs-microservice/onlywallet-backend/node_modules/express/lib/response.js:267:15)
    at ServerResponse.send (/Users/a1353612/soundofmusic/compile1010/nodejs-microservice/onlywallet-backend/node_modules/express/lib/response.js:158:21)
    at app.get (/Users/a1353612/soundofmusic/compile1010/nodejs-microservice/onlywallet-backend/app.js:42:52)
    at Layer.handle [as handle_request] (/Users/a1353612/soundofmusic/compile1010/nodejs-microservice/onlywallet-backend/node_modules/express/lib/router/layer.js:95:5)
    at next (/Users/a1353612/soundofmusic/compile1010/nodejs-microservice/onlywallet-backend/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/Users/a1353612/soundofmusic/compile1010/nodejs-microservice/onlywallet-backend/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/Users/a1353612/soundofmusic/compile1010/nodejs-microservice/onlywallet-backend/node_modules/express/lib/router/layer.js:95:5)
err adding session: Error: Timed out while trying to establish connection
err setting new session: Error: Timed out while trying to establish connection

https://stackoverflow.com/questions/23714383/what-are-all-the-possible-values-for-http-content-type-header

@prayagupa prayagupa changed the title Content-Type header needs to be one as defined by HTTP team Content-Type header needs to be one as defined by IANA team Sep 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant