Skip to content

Commit

Permalink
Return response promise (#16)
Browse files Browse the repository at this point in the history
Co-authored-by: Jon Breen <[email protected]>
  • Loading branch information
cultpodcasts and cultpodcasts committed Mar 29, 2024
1 parent 315090f commit aec09d8
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ export default {
.json()
.then(async (data: any) => {
let dataPoint: AnalyticsEngineDataPoint = { indexes: [], blobs: [] };
let ipAddress: string ="";
let asn: string ="";
let city: string ="";
let ipAddress: string = "";
let asn: string = "";
let city: string = "";
if (request.cf) {
dataPoint.blobs!.push(request.cf.clientTrustScoretr as string);
asn = request.cf.asn as string;
Expand Down Expand Up @@ -102,8 +102,7 @@ export default {
}
dataPoint.indexes!.push(index);

if (!data.search && !data.filter)
{
if (!data.search && !data.filter) {
console.log("Unrecognised search request");
}
if (dataPoint) {
Expand Down Expand Up @@ -170,13 +169,12 @@ export default {
"apple": null,
"youtube": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"subjects": []
}
]
}
;
}]
};
dataPoint.blobs!.push("Leech");
env.Analytics.writeDataPoint(dataPoint);
return new Response(JSON.stringify(leechResponse));
var response = new Response(JSON.stringify(leechResponse));
return new Promise<Response>((resolve) => { resolve(response) });
}

});
Expand Down

0 comments on commit aec09d8

Please sign in to comment.