Skip to content

Commit

Permalink
Merge pull request #2301 from telefonicaid/bug/2174_incorrect_error_r…
Browse files Browse the repository at this point in the history
…esponse_when_running_invalid_query

bug/2174_incorrect_error_response_when_running_invalid_query
  • Loading branch information
Fermín Galán Márquez authored Jun 17, 2016
2 parents 2b1ad95 + 4b289a7 commit fc3b270
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
- Fix: Correctly returning error on present but empty attribute types in PATCH v2/entites/{id} operation (Issue #1785)
- Fix: Error returned on encountering non-existing attributes in PATCH /v2/entities/<id>/attrs (Issue #1784)
- Fix: Error payload returned on encountering non-existing entity/attribute in PUT /v2/entities/<entity-id>/attrs/<attr-name> (Issue #1360)

- Fix: Better error returned on invalid geoquery (Issue #2174)
2 changes: 1 addition & 1 deletion src/lib/orionTypes/areas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ int Georel::parse(const char* in, std::string* errorString)
}
else
{
*errorString = "Invalid selector in georel specification";
*errorString = "Invalid modifier in georel parameter";
return -1;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Copyright 2016 Telefonica Investigacion y Desarrollo, S.A.U
#
# This file is part of Orion Context Broker.
#
# Orion Context Broker is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# Orion Context Broker is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
# General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Orion Context Broker. If not, see http://www.gnu.org/licenses/.
#
# For those usages not covered by this license please contact with
# iot_support at tid dot es

# VALGRIND_READY - to mark the test ready for valgrindTestSuite.sh

--NAME--
Incorrect error response when running invalid query

--SHELL-INIT--
dbInit CB
brokerStart CB

--SHELL--

#
# 01. Query with invalid modifier in georel parameter, and see error
#

echo "01. Query with invalid modifier in georel parameter, and see error"
echo "=================================================================="
orionCurl --url '/v2/entities/?type=Restaurant&georel=near;maxDistance=1000&geometry=point&coords=43.42015,-2.761160&options=keyValues'
echo
echo


--REGEXPECT--
01. Query with invalid modifier in georel parameter, and see error
==================================================================
HTTP/1.1 400 Bad Request
Content-Length: 90
Content-Type: application/json
Fiware-Correlator: REGEX([0-9a-f\-]{36})
Date: REGEX(.*)

{
"description": "Invalid query: Invalid modifier in georel parameter",
"error": "BadRequest"
}


--TEARDOWN--
brokerStop CB
dbDrop CB

0 comments on commit fc3b270

Please sign in to comment.