Skip to content
Permalink
Browse files

Merge pull request #1631 from OSGeo/backport-1629-to-release/3.0

[Backport release/3.0] ES: Set 'application/json' in RunRequest() with POST (fixes #1628)
  • Loading branch information...
rouault committed Jun 10, 2019
2 parents 00e021d + 0d495f1 commit 967358068e973b894eb95fb747fe0a06559711f9
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 9673580

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