Skip to content

Commit

Permalink
Fix HttpAdapter proxy this scoping
Browse files Browse the repository at this point in the history
  • Loading branch information
CarsonF committed Oct 8, 2024
1 parent 6cc69d7 commit 3a0fbe7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/core/http/http.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@ import { HttpAdapter, HttpAdapterHost } from './http.adapter';
]),
);
return new Proxy(host, {
get(_, key, receiver) {
get(_, key) {
const { httpAdapter } = host;
if (key === 'httpAdapter') {
return httpAdapter;
}
if (key === 'constructor') {
return HttpAdapter.constructor;
}
Expand All @@ -36,7 +33,8 @@ import { HttpAdapter, HttpAdapterHost } from './http.adapter';
if (!httpAdapter) {
throw new Error('HttpAdapter is not yet available');
}
return Reflect.get(httpAdapter, key, receiver);
const val = Reflect.get(httpAdapter, key, httpAdapter);
return typeof val === 'function' ? val.bind(httpAdapter) : val;
},
});
},
Expand Down

0 comments on commit 3a0fbe7

Please sign in to comment.