Skip to content
This repository has been archived by the owner on Nov 15, 2024. It is now read-only.

Commit

Permalink
updated headers for simulator
Browse files Browse the repository at this point in the history
  • Loading branch information
DarpanLalani committed Nov 27, 2023
1 parent 10b0274 commit ede6685
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions builder/simulator/device-interval-simulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,24 @@ export abstract class DeviceIntervalSimulator extends DeviceSimulator {
}

async createMeasurement(entity: Partial<IMeasurementCreate>) {
return this.fetchClient.fetch("/measurement/measurements", {
headers: {
"content-type": "application/json",
"Accept": "application/json"
},
let { headers } = this.fetchClient.getFetchOptions({});
delete(headers["X-Cumulocity-Application-Key"]); // Need to remove this key to make device available whenever measurements sent
headers["content-type"] = "application/json";
headers["Accept"] = "application/json";
return fetch("/measurement/measurements", {
headers,
body: JSON.stringify(entity),
method: 'POST'
});
}

async createEvent(entity: IEvent) {
return this.fetchClient.fetch("/event/events", {
headers: {
"content-type": "application/json",
"Accept": "application/json"
},
let { headers } = this.fetchClient.getFetchOptions({});
delete(headers["X-Cumulocity-Application-Key"]); // Need to remove this key to make device available whenever measurements sent
headers["content-type"] = "application/json";
headers["Accept"] = "application/json";
return fetch("/event/events", {
headers,
body: JSON.stringify(entity),
method: 'POST'
});
Expand Down

0 comments on commit ede6685

Please sign in to comment.