Skip to content
This repository was archived by the owner on Sep 2, 2022. It is now read-only.

Commit 1754916

Browse files
committed
Mark status code as optional to match latest Apilytics OpenAPI schema
1 parent b06b361 commit 1754916

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

packages/core/src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ interface Params {
66
apiKey: string;
77
path: string;
88
method: string;
9-
statusCode: number | null;
109
timeMillis: number;
1110
query?: string;
11+
statusCode?: number | null;
1212
apilyticsIntegration?: string;
1313
integratedLibrary?: string;
1414
}
@@ -21,14 +21,14 @@ interface Params {
2121
* @param params.apiKey - The API key for your Apilytics origin.
2222
* @param params.path - Path of the user's HTTP request, e.g. '/foo/bar/123'.
2323
* @param params.method - Method of the user's HTTP request, e.g. 'GET'.
24-
* @param params.statusCode - Status code for the sent HTTP response.
25-
* Can be null if the middleware could not get the status code
26-
* for the response. E.g. if the inner request handling threw an exception.
2724
* @param params.timeMillis - The amount of time in milliseconds it took
2825
* to respond to the user's request.
2926
* @param params.query - Optional query string of the user's HTTP request
3027
* e.g. 'key=val&other=123'. An empty string and null are treated equally.
3128
* Can have an optional '?' at the start.
29+
* @param params.statusCode - Status code for the sent HTTP response.
30+
* Can be omitted (or null) if the middleware could not get the status code
31+
* for the response. E.g. if the inner request handling threw an exception.
3232
* @param params.apilyticsIntegration - Name of the Apilytics integration that's
3333
* calling this, e.g. 'apilytics-node-express'.
3434
* No need to pass this when calling from user code.
@@ -53,9 +53,9 @@ export const sendApilyticsMetrics = ({
5353
apiKey,
5454
path,
5555
method,
56-
statusCode,
5756
timeMillis,
5857
query,
58+
statusCode,
5959
apilyticsIntegration,
6060
integratedLibrary,
6161
}: Params): void => {

packages/next/__tests__/index.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ describe('withApilytics()', () => {
174174
expect(data).toStrictEqual({
175175
path: '/error',
176176
method: 'GET',
177-
statusCode: null,
178177
timeMillis: expect.any(Number),
179178
});
180179
});

0 commit comments

Comments
 (0)