Skip to content

Commit

Permalink
Merge pull request #1837 from telefonicaid/feature/17675_type_in_loca…
Browse files Browse the repository at this point in the history
…tion_header

Feature/17675 type in location header
  • Loading branch information
Fermín Galán Márquez committed Feb 24, 2016
2 parents 8dcef50 + 1cfd803 commit 2963365
Show file tree
Hide file tree
Showing 159 changed files with 320 additions and 311 deletions.
1 change: 1 addition & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@
- Add: orderBy URI param in NGSIv1 queries to sort entities by attribute (Issue #1103)
- Fix: Returning 422 InvalidModification instead of 404 NotFound when POSTing entity (Issue #1817)
- Add implemented new operation: POST /v2/op/update (Issue #1715)
- Add: ?type URL parameter in Location header upon entity creation in NGSIv2 (Issue #1765)
2 changes: 1 addition & 1 deletion doc/apiary/v2/fiware-ngsiv2-cookbook.apib
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ This resource allows you to obtain a list of subresources published by the API:

+ Headers

Location: /v2/entities/Bcn-Welt
Location: /v2/entities/Bcn-Welt?type=Room


### Create a new entity. Error [POST /v2/entities]
Expand Down
2 changes: 1 addition & 1 deletion doc/apiary/v2/fiware-ngsiv2-reference.apib
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ Response:

+ Headers

Location: /v2/entities/Bcn-Welt
Location: /v2/entities/Bcn-Welt?type=Room


## Entity by ID [/v2/entities/{entityId}{?type,attrs,options}]
Expand Down
8 changes: 8 additions & 0 deletions src/lib/serviceRoutinesV2/postEntities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ std::string postEntities
if (rhttpcode == SccOk || rhttpcode == SccNone)
{
std::string location = "/v2/entities/" + eP->id;
if (eP->type != "" )
{
location += "?type=" + eP->type;
}
else
{
location += "?type=none";
}

ciP->httpHeader.push_back("Location");
ciP->httpHeaderValue.push_back(location);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ echo
=======================================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E1
Location: /v2/entities/E1?type=T
Date: REGEX(.*)


Expand All @@ -143,7 +143,7 @@ Date: REGEX(.*)
========================================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E2
Location: /v2/entities/E2?type=T
Date: REGEX(.*)


Expand All @@ -152,7 +152,7 @@ Date: REGEX(.*)
=======================================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E3
Location: /v2/entities/E3?type=T
Date: REGEX(.*)


Expand All @@ -161,7 +161,7 @@ Date: REGEX(.*)
========================================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E4
Location: /v2/entities/E4?type=T
Date: REGEX(.*)


Expand All @@ -170,7 +170,7 @@ Date: REGEX(.*)
=======================================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E5
Location: /v2/entities/E5?type=T
Date: REGEX(.*)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Date: REGEX(.*)
=====================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E1
Location: /v2/entities/E1?type=T1
Date: REGEX(.*)


Expand Down Expand Up @@ -234,7 +234,7 @@ Date: REGEX(.*)
===================================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E2
Location: /v2/entities/E2?type=T1
Date: REGEX(.*)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ echo
==========================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E1
Location: /v2/entities/E1?type=T1
Date: REGEX(.*)


Expand All @@ -128,7 +128,7 @@ Date: REGEX(.*)
===========================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E2
Location: /v2/entities/E2?type=T2
Date: REGEX(.*)


Expand All @@ -137,7 +137,7 @@ Date: REGEX(.*)
==========================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E3
Location: /v2/entities/E3?type=T3
Date: REGEX(.*)


Expand All @@ -146,7 +146,7 @@ Date: REGEX(.*)
===========================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E4
Location: /v2/entities/E4?type=T4
Date: REGEX(.*)


Expand All @@ -155,7 +155,7 @@ Date: REGEX(.*)
==========================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E5
Location: /v2/entities/E5?type=T5
Date: REGEX(.*)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ echo
===================================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/8787GHY
Location: /v2/entities/8787GHY?type=Car
Date: REGEX(.*)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Date: REGEX(.*)
=======================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E1
Location: /v2/entities/E1?type=T1
Date: REGEX(.*)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ echo
==========================================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E1
Location: /v2/entities/E1?type=T1
Date: REGEX(.*)


Expand All @@ -113,7 +113,7 @@ Date: REGEX(.*)
==========================================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E1
Location: /v2/entities/E1?type=T2
Date: REGEX(.*)


Expand All @@ -122,7 +122,7 @@ Date: REGEX(.*)
==========================================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E1
Location: /v2/entities/E1?type=T3
Date: REGEX(.*)


Expand All @@ -131,7 +131,7 @@ Date: REGEX(.*)
==========================================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E1
Location: /v2/entities/E1?type=T4
Date: REGEX(.*)


Expand All @@ -140,7 +140,7 @@ Date: REGEX(.*)
==========================================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E1
Location: /v2/entities/E1?type=T5
Date: REGEX(.*)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ echo
===========================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E1
Location: /v2/entities/E1?type=T1
Date: REGEX(.*)


Expand All @@ -108,7 +108,7 @@ Date: REGEX(.*)
===========================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E1
Location: /v2/entities/E1?type=T2
Date: REGEX(.*)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Date: REGEX(.*)
==================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E1
Location: /v2/entities/E1?type=T1
Date: REGEX(.*)


Expand Down Expand Up @@ -168,7 +168,7 @@ Date: REGEX(.*)
=================================================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E2
Location: /v2/entities/E2?type=T1
Date: REGEX(.*)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ echo
=====================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E1
Location: /v2/entities/E1?type=T1
Date: REGEX(.*)


Expand All @@ -127,7 +127,7 @@ Date: REGEX(.*)
=====================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E2
Location: /v2/entities/E2?type=T2
Date: REGEX(.*)


Expand All @@ -136,7 +136,7 @@ Date: REGEX(.*)
=====================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E3
Location: /v2/entities/E3?type=T3
Date: REGEX(.*)


Expand All @@ -145,7 +145,7 @@ Date: REGEX(.*)
=====================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E4
Location: /v2/entities/E4?type=T4
Date: REGEX(.*)


Expand All @@ -154,7 +154,7 @@ Date: REGEX(.*)
=====================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E5
Location: /v2/entities/E5?type=T5
Date: REGEX(.*)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Date: REGEX(.*)
==================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E1
Location: /v2/entities/E1?type=T1
Date: REGEX(.*)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ echo
=====================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E1
Location: /v2/entities/E1?type=T1
Date: REGEX(.*)


Expand All @@ -128,7 +128,7 @@ Date: REGEX(.*)
=====================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E2
Location: /v2/entities/E2?type=T1
Date: REGEX(.*)


Expand All @@ -137,7 +137,7 @@ Date: REGEX(.*)
=====================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E3
Location: /v2/entities/E3?type=T2
Date: REGEX(.*)


Expand All @@ -146,7 +146,7 @@ Date: REGEX(.*)
=====================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E1
Location: /v2/entities/E1?type=T3
Date: REGEX(.*)


Expand All @@ -155,7 +155,7 @@ Date: REGEX(.*)
=====================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E2
Location: /v2/entities/E2?type=T3
Date: REGEX(.*)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ echo
=====================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E1
Location: /v2/entities/E1?type=T1
Date: REGEX(.*)


Expand All @@ -126,7 +126,7 @@ Date: REGEX(.*)
=====================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E2
Location: /v2/entities/E2?type=T1
Date: REGEX(.*)


Expand All @@ -135,7 +135,7 @@ Date: REGEX(.*)
=====================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E3
Location: /v2/entities/E3?type=T2
Date: REGEX(.*)


Expand All @@ -144,7 +144,7 @@ Date: REGEX(.*)
=====================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E1
Location: /v2/entities/E1?type=T3
Date: REGEX(.*)


Expand All @@ -153,7 +153,7 @@ Date: REGEX(.*)
=====================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E2
Location: /v2/entities/E2?type=T3
Date: REGEX(.*)


Expand Down
Loading

0 comments on commit 2963365

Please sign in to comment.