@zimic/interceptor 0.14.0-canary.22 → 0.14.0-canary.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/http.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { HttpMethodSchema, HttpStatusCode, HttpRequest, HttpHeaders, HttpRequestHeadersSchema, InferPathParams, HttpSearchParams, HttpRequestSearchParamsSchema, HttpRequestBodySchema, HttpResponse, HttpResponseHeadersSchema, HttpResponseBodySchema, HttpResponseSchema, HttpHeadersInit, HttpSchema, HttpBody, HttpSchemaMethod, HttpSchemaPath, HttpHeadersSchema, HttpSearchParamsSchema, HttpFormData, HttpResponseSchemaStatusCode, HttpMethod, LiteralHttpSchemaPathFromNonLiteral } from '@zimic/http';
2
- import { Default, PossiblePromise, ReplaceBy, IfNever, DeepPartial, Range } from '@zimic/utils/types';
2
+ import { Default, PossiblePromise, ReplaceBy, PartialByKey, IfNever, DeepPartial, Range } from '@zimic/utils/types';
3
3
 
4
4
  type HttpRequestHandlerResponseWithBody<ResponseSchema extends HttpResponseSchema> = unknown extends ResponseSchema['body'] ? {
5
5
  body?: null;
@@ -8,10 +8,13 @@ type HttpRequestHandlerResponseWithBody<ResponseSchema extends HttpResponseSchem
8
8
  } : {
9
9
  body: ReplaceBy<ResponseSchema['body'], ArrayBuffer, Blob>;
10
10
  };
11
+ type HttpRequestHandlerResponseHeaders<ResponseSchema extends HttpResponseSchema> = HttpHeadersInit<PartialByKey<Default<ResponseSchema['headers']>, 'content-type'>>;
11
12
  type HttpRequestHandlerResponseWithHeaders<ResponseSchema extends HttpResponseSchema> = undefined extends ResponseSchema['headers'] ? {
12
- headers?: undefined;
13
+ headers?: HttpRequestHandlerResponseHeaders<ResponseSchema>;
14
+ } : keyof ResponseSchema['headers'] extends 'content-type' ? {
15
+ headers?: HttpRequestHandlerResponseHeaders<ResponseSchema>;
13
16
  } : {
14
- headers: HttpHeadersInit<Default<ResponseSchema['headers']>>;
17
+ headers: HttpRequestHandlerResponseHeaders<ResponseSchema>;
15
18
  };
16
19
  /** A declaration of an HTTP response for an intercepted request. */
17
20
  type HttpRequestHandlerResponseDeclaration<MethodSchema extends HttpMethodSchema = HttpMethodSchema, StatusCode extends HttpStatusCode = HttpStatusCode> = StatusCode extends StatusCode ? {