You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "glynnbird (via GitHub)" <gi...@apache.org> on 2026/04/01 08:05:45 UTC
[PR] Ensure that all application/json responses are parsed as JSON [couchdb-nano]
glynnbird opened a new pull request, #368:
URL: https://github.com/apache/couchdb-nano/pull/368
## Overview
Issue #366 reported that a content-type of `application/json; charset=utf-8` was not being parsed as json. This PR fixes that.
## Testing recommendations
Automated test added to try a content-type with a charset.
## GitHub issue number
Fixes issue #366.
## Related Pull Requests
n/a
## Checklist
- [x] Code is written and works correctly;
- [x] Changes are covered by tests;
- [x] Documentation reflects the changes;
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Ensure that all application/json responses are parsed as JSON [couchdb-nano]
Posted by "glynnbird (via GitHub)" <gi...@apache.org>.
glynnbird commented on code in PR #368:
URL: https://github.com/apache/couchdb-nano/pull/368#discussion_r3020736839
##########
lib/nano.js:
##########
@@ -148,7 +148,7 @@ module.exports = exports = function dbScope (cfg) {
// when doing head requests, we return the response headers, not the response body
if (req.method === 'head') {
retval = Object.fromEntries(response.headers)
- } else if (contentType === 'application/json') {
+ } else if (contentType && contentType.startsWith('application/json')) {
Review Comment:
I've just checked, and they are not! 🫤
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Ensure that all application/json responses are parsed as JSON [couchdb-nano]
Posted by "big-r81 (via GitHub)" <gi...@apache.org>.
big-r81 commented on code in PR #368:
URL: https://github.com/apache/couchdb-nano/pull/368#discussion_r3020645531
##########
lib/nano.js:
##########
@@ -148,7 +148,7 @@ module.exports = exports = function dbScope (cfg) {
// when doing head requests, we return the response headers, not the response body
if (req.method === 'head') {
retval = Object.fromEntries(response.headers)
- } else if (contentType === 'application/json') {
+ } else if (contentType && contentType.startsWith('application/json')) {
Review Comment:
Short question: Are these headers always trimmed before?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Ensure that all application/json responses are parsed as JSON [couchdb-nano]
Posted by "glynnbird (via GitHub)" <gi...@apache.org>.
glynnbird commented on code in PR #368:
URL: https://github.com/apache/couchdb-nano/pull/368#discussion_r3020776382
##########
lib/nano.js:
##########
@@ -148,7 +148,7 @@ module.exports = exports = function dbScope (cfg) {
// when doing head requests, we return the response headers, not the response body
if (req.method === 'head') {
retval = Object.fromEntries(response.headers)
- } else if (contentType === 'application/json') {
+ } else if (contentType && contentType.startsWith('application/json')) {
Review Comment:
I'm not going to worry about it just now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Ensure that all application/json responses are parsed as JSON [couchdb-nano]
Posted by "glynnbird (via GitHub)" <gi...@apache.org>.
glynnbird merged PR #368:
URL: https://github.com/apache/couchdb-nano/pull/368
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org