Skip to content

Commit f9b4e72

Browse files
committed
Drop very old CB handler internal backward compat
1 parent 11e191c commit f9b4e72

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

src/rules/requests/request-handler-definitions.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
} from "../../types";
2121

2222
import { Replace } from '../../util/type-utils';
23-
import { buildBodyReader } from '../../util/request-utils';
2423
import { asBuffer } from '../../util/buffer-utils';
2524
import {
2625
Serializable,
@@ -316,10 +315,7 @@ export interface SerializedCallbackHandlerData {
316315
* @internal
317316
*/
318317
export interface CallbackRequestMessage {
319-
args: [
320-
| Replace<CompletedRequest, { body: string }> // New format
321-
| CompletedRequest // Old format with directly serialized body
322-
];
318+
args: [Replace<CompletedRequest, { body: string }>];
323319
}
324320

325321
export class CallbackHandlerDefinition extends Serializable implements RequestHandlerDefinition {
@@ -343,14 +339,10 @@ export class CallbackHandlerDefinition extends Serializable implements RequestHa
343339
CallbackRequestMessage,
344340
CallbackResponseResult
345341
>(async (streamMsg) => {
346-
const request = _.isString(streamMsg.args[0].body)
347-
? withDeserializedBodyReader( // New format: body serialized as base64
348-
streamMsg.args[0] as Replace<CompletedRequest, { body: string }>
349-
)
350-
: { // Backward compat: old fully-serialized format
351-
...streamMsg.args[0],
352-
body: buildBodyReader(streamMsg.args[0].body.buffer, streamMsg.args[0].headers)
353-
};
342+
const request = withDeserializedBodyReader(
343+
// Body serialized as base64
344+
streamMsg.args[0]
345+
)
354346

355347
const callbackResult = await this.callback.call(null, request);
356348

src/rules/requests/request-handlers.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,7 @@ export class CallbackHandler extends CallbackHandlerDefinition {
253253
| WithSerializedCallbackBuffers<CallbackResponseMessageResult>
254254
| 'close'
255255
| 'reset'
256-
>({ args: [
257-
(version || -1) >= 2
258-
? withSerializedBodyReader(request)
259-
: request // Backward compat: old handlers
260-
] });
256+
>({ args: [withSerializedBodyReader(request)] });
261257

262258
if (typeof callbackResult === 'string') {
263259
return callbackResult;

0 commit comments

Comments
 (0)