Skip to content
Permalink
Browse files

Merge pull request #1629 from jbo-ads/elastic_postfields_json

ES: Set 'application/json' in RunRequest() with POST (fixes #1628)
  • Loading branch information...
rouault committed Jun 10, 2019
2 parents 557f5be + 7aa71f2 commit ac094682e1adc92192fc2914f72d99b83708a908
Showing with 4 additions and 3 deletions.
  1. +4 −3 gdal/ogr/ogrsf_frmts/elastic/ogrelasticdatasource.cpp
@@ -538,6 +538,8 @@ json_object* OGRElasticDataSource::RunRequest(const char* pszURL,
{
papszOptions = CSLSetNameValue(papszOptions, "POSTFIELDS",
pszPostContent);
papszOptions = CSLAddNameValue(papszOptions, "HEADERS",
"Content-Type: application/json; charset=UTF-8");
}

CPLPushErrorHandler(CPLQuietErrorHandler);
@@ -723,11 +725,10 @@ bool OGRElasticDataSource::UploadFile( const CPLString &url,
}
else
{

papszOptions = CSLAddNameValue(papszOptions, "POSTFIELDS", data.c_str());
papszOptions = CSLAddNameValue(papszOptions, "HEADERS",
"Content-Type: application/json; charset=UTF-8");
}
papszOptions = CSLAddNameValue(papszOptions, "HEADERS",
"Content-Type: application/json; charset=UTF-8");

CPLHTTPResult* psResult = HTTPFetch(url, papszOptions);
CSLDestroy(papszOptions);

0 comments on commit ac09468

Please sign in to comment.
You can’t perform that action at this time.