Closed mifreudi closed 6 years ago
You're correct. The status is not set. It should be 404. We will need to investigate why that is the case and if we can change it without side effects. Thanks for reporting this inconsistency.
Is fixed. Will be contained in next release.
Bugfix has been released in 1.0.5
For all HTTP-responses unequal to "Measurement Id not found" the HTTP-status code is set corrcetly unequal to '0'.
In case of "Measurement Id not found" the HTTP-response status code is set always to '0' (reason: wrong constructor selected)
Test for measurement not found: valid DeviceId = 4471037 in CoT-Tenant
CloudOfThingsPlatform cotPlatform = new CloudOfThingsPlatform("url", new CotCredentials("tenant", "user", "password"));
try { Measurement cotDevice4471037 = cotPlatform.getMeasurementApi().getMeasurement("4471037"); System.out.println("cotDevice4471037 = " + cotDevice4471037); return "cotDevice4471037 = " + cotDevice4471037; } catch(CotSdkException e){ System.out.println(e.getMessage()); return "error: status=" + e.getHttpStatus() + " message=" + e.getMessage(); }
TestResult: error: status=0 message=Measurement not found (id='4471037')