Closed simontankersley closed 1 year ago
Thanks for the fix @jamesdbloom. The return type of MockServerClient.retrieveRecordedRequestsAndResponses in the typescript client is now Promise<HttpRequestAndHttpResponse[]>:
retrieveRecordedRequestsAndResponses(pathOrRequestDefinition: PathOrRequestDefinition): Promise<HttpRequestAndHttpResponse[]>;
However in server and client 5.14.0 when comparing the typescript schema of HttpRequestAndHttpResponse against the javascript object returned there is a difference for some reason.
The typescript schema of HttpRequestAndHttpResponse is:
export type HttpRequestAndHttpResponse = {
httpRequest?: HttpRequest[];
httpResponse?: HttpResponse[];
timestamp?: string;
};
export interface HttpRequest {
headers?: KeyToMultiValue;
...
}
export type KeyToMultiValue =
| { name?: string; values?: string[] }[]
| { keyMatchStyle?: "MATCHING_KEY" | "SUB_SET"; [key: string]: any };
However the HttpRequestAndHttpResponse objects in the returned in the HttpRequestAndHttpResponse[] array have structure:
{
httpRequest: {
headers: {
'header1': ['value1']
'header2': ['value2']
...
}
}
}
not:
{
httpRequest: [
{
headers: [
{
name: 'header1',
value: ['value1']
},
{
name: 'header2',
value: ['value2']
}
...
]
}
]
}
I've worked around the mis match with code:
const headers = (requestAndResponse.httpRequest as any).headers
const header1values = headers['header1']
Hi there, firstly thank you for such a great product.
I think I've found an issue. I see the resolution of this past issue was support for a retrieve type of "request_response". I think perhaps the openapi schema update to the responses and schema sections were overlooked. I also note that the return type of
MockServerClient.retrieveRecordedRequestsAndResponses
in the typescript client isPromise<Expectation[]>
not something likePromise<RequestResponse[]>
(and this could be related to the missing open api spec changes)