diff --git a/src/api/endpoint/api/search.ts b/src/api/endpoint/api/search.ts index 8df4c5567..22eb4b476 100644 --- a/src/api/endpoint/api/search.ts +++ b/src/api/endpoint/api/search.ts @@ -1,3 +1,5 @@ +import { HEADERS } from "../../../lib/constants"; + /** * @prettier */ @@ -11,6 +13,7 @@ export default function(route, auth, storage): void { let firstPackage = true; res.status(200); + res.set(HEADERS.CONTENT_TYPE, HEADERS.JSON_CHARSET) /* * Offical NPM registry (registry.npmjs.org) no longer return whole database, diff --git a/test/unit/modules/api/api.spec.ts b/test/unit/modules/api/api.spec.ts index 9d4af4c5f..037a82147 100644 --- a/test/unit/modules/api/api.spec.ts +++ b/test/unit/modules/api/api.spec.ts @@ -621,7 +621,7 @@ describe('endpoint unit test', () => { .get('/-/all/since?stale=update_after&startkey=' + cacheTime) // .set('accept-encoding', HEADERS.JSON) // .set(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON) - // .expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET) + .expect(HEADERS.CONTENT_TYPE, HEADERS.JSON_CHARSET) .expect(HTTP_STATUS.OK) .end(function(err) { if (err) {