Skip to content

Commit

Permalink
feat: allow clone with httpFile #425
Browse files Browse the repository at this point in the history
  • Loading branch information
AnWeber committed Mar 30, 2023
1 parent 515b140 commit 1229afb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"type": "node",
"request": "launch",
"name": "launch",
"name": "debug",
"skipFiles": [
"<node_internals>/**"
],
Expand Down
3 changes: 2 additions & 1 deletion src/models/httpRegion.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ExecuteHook, OnRequestHook, OnStreaming, OnResponseHook, ResponseLoggingHook } from './hooks';
import { HttpFile } from './httpFile';
import { Request } from './httpRequest';
import { HttpResponse } from './httpResponse';
import { HttpSymbol } from './httpSymbol';
Expand Down Expand Up @@ -33,6 +34,6 @@ export interface HttpRegion {
responseLogging: ResponseLoggingHook;
};
isGlobal(): boolean;
clone(): HttpRegion;
clone(httpFile?: HttpFile): HttpRegion;
execute(context: PartialProperty<ProcessorContext, 'httpRegion'>, isMainContext?: boolean): Promise<boolean>;
}
4 changes: 2 additions & 2 deletions src/store/httpRegion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export class HttpRegion implements models.HttpRegion {
return !(this.request || this.metaData.name);
}

public clone() {
const httpRegion = new HttpRegion(this.httpFile);
public clone(httpFile?: models.HttpFile) {
const httpRegion = new HttpRegion(httpFile || this.httpFile);
httpRegion.request = this.request;
Object.assign(httpRegion.symbol, this.symbol);
Object.assign(httpRegion.hooks, this.hooks);
Expand Down

0 comments on commit 1229afb

Please sign in to comment.