|
4 | 4 | import * as fs from 'fs/promises';
|
5 | 5 | import { inspect } from 'util';
|
6 | 6 | console.log(process.versions);
|
7 |
| -const API_PATH = "https://performance-monitoring-service-rest.server-tig.prod.corp.mongodb.com/raw_perf_results"; |
| 7 | +const API_PATH = 'https://performance-monitoring-api.corp.mongodb.com/raw_perf_results'; |
8 | 8 |
|
9 | 9 | const resultFile = process.argv[2];
|
10 | 10 | if (resultFile == undefined) {
|
11 |
| - throw new Error("Must specify result file"); |
| 11 | + throw new Error('Must specify result file'); |
12 | 12 | }
|
13 | 13 |
|
14 | 14 | // Get expansions
|
@@ -58,26 +58,25 @@ const body = {
|
58 | 58 | console.log(inspect(body, { depth: Infinity }));
|
59 | 59 |
|
60 | 60 | const resp = await fetch(API_PATH, {
|
61 |
| - method: "POST", |
| 61 | + method: 'POST', |
62 | 62 | headers: {
|
63 |
| - "Content-Type": "application/json", |
64 |
| - "accept": "application/json" |
| 63 | + 'Content-Type': 'application/json', |
| 64 | + accept: 'application/json' |
65 | 65 | },
|
66 | 66 | body: JSON.stringify(body)
|
67 | 67 | });
|
68 | 68 |
|
69 |
| - |
70 | 69 | console.log(await resp.text());
|
71 | 70 |
|
72 | 71 | let jsonResponse;
|
73 | 72 | try {
|
74 | 73 | jsonResponse = await resp.json();
|
75 | 74 | } catch (e) {
|
76 |
| - throw new Error("Failed to parse json response", { cause: e }); |
| 75 | + throw new Error('Failed to parse json response', { cause: e }); |
77 | 76 | }
|
78 | 77 |
|
79 | 78 | console.log(inspect(jsonResponse, { depth: Infinity }));
|
80 | 79 |
|
81 | 80 | if (!jsonResponse.message) throw new Error("Didn't get success message");
|
82 | 81 |
|
83 |
| -console.log("Successfully posted results"); |
| 82 | +console.log('Successfully posted results'); |
0 commit comments