HttpProvider support clone() (#3949)

* HttpProvider support clone()

* fix lint
This commit is contained in:
Ian He
2021-09-15 06:31:35 +03:00
committed by GitHub
parent f695cd0835
commit f28d648fac
2 changed files with 9 additions and 1 deletions
@@ -29,6 +29,14 @@ describe('Http', (): void => {
).not.toThrow();
});
it('allow clone', (): void => {
const clone = http.clone();
/* eslint-disable */
expect((clone as any)['#endpoint']).toEqual((http as any)['#endpoint']);
expect((clone as any)['#headers']).toEqual((http as any)['#headers']);
/* eslint-enable */
});
it('always returns isConnected true', (): void => {
expect(http.isConnected).toEqual(true);
});
+1 -1
View File
@@ -62,7 +62,7 @@ export class HttpProvider implements ProviderInterface {
* @description Returns a clone of the object
*/
public clone (): HttpProvider {
throw new Error('Unimplemented');
return new HttpProvider(this.#endpoint, this.#headers);
}
/**