node.js - 未处理的拒绝错误:不支持 Content-Type 标头 []
问题描述
我的 Node.js 应用程序中有一个弹性查询,如下所示。我正在使用弹性搜索版本 6.2.2。但是当我从邮递员执行 API 时,它显示以下错误:
Unhandled rejection Error: Content-Type header [] is not supported
exports.radix = function (req, res) {
var elasticsearch = require('elasticsearch'),
client = new elasticsearch.Client({
host: 'localhost:9200'
});
client.search({
index: 'xpertradix',
type: 'search',
size: 20,
body: {
query: {
match: {
name: req.param('term')
}
}
}
}).then(function (resp) {
var data = helper.prepareRadix(resp.hits.hits);
res.json(data);
});
};
我一直在努力解决这个问题 2 天。有人可以帮我解决这个问题吗?
解决方案
推荐阅读
- sql-server - SQL - 分组时仅返回一次值总和
- string - 没有任何东西从 Processing 发送到 Arduino
- powershell - PowerShell 循环遍历 CSV 列并根据另一个 CSV 的条件更改值
- google-bigquery - 如何在 BigQuery 中显示多层次树结构
- corda - 帐户库:序列化失败方向 =“Deserialize”,预期为布尔值,但为 SignedTransaction
- java - 如何在spring webflux的同一函数中更新多个mongo集合?
- c# - 由于控制器中没有异步导致 500 服务器错误?需要帮助从列表中删除对象 C#
- javascript - 如何将值从控制器传递到 JavaScript 图表
- matlab - Octave 中的 validateattributes 函数存在问题
- r - 如何刻面图,每个图都包含一个插图?