Skip to content

Commit

Permalink
Remove browser check (Azure#197)
Browse files Browse the repository at this point in the history
Webpack will do this for us
  • Loading branch information
southpolesteve authored Nov 28, 2018
1 parent a17f918 commit ea9c01f
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/request/request.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { ClientRequest, ClientResponse } from "http"; // TYPES ONLY
import * as httpsTypes from "https"; // TYPES ONLY
import * as https from "https"; // TYPES ONLY
import { Socket } from "net";
import { Stream } from "stream";
import * as url from "url";

import { Constants, Helper } from "../common";
import { ConnectionPolicy, MediaReadMode } from "../documents";
import { IHeaders } from "../queryExecutionContext";
Expand All @@ -16,16 +17,6 @@ import { AuthHandler, AuthOptions } from "../auth";
import { Response } from "./Response";
export { Response }; // Should refactor this out

/** @hidden */
const isBrowser = new Function("try {return this===window;}catch(e){ return false;}");

// TODO: :This feels hacky... Maybe just do this in the webpack.config.json?
// Alternatively, we can move to superagent which will handle this for us...
// tslint:disable:no-var-requires
/** @hidden */
const https = isBrowser && false ? require("stream-http") : require("https");
// tslint:enable:no-var-requires

// ----------------------------------------------------------------------------
// Utility methods
//
Expand Down Expand Up @@ -64,7 +55,7 @@ export function parse(urlString: string) {
/** @hidden */
export function createRequestObject(
connectionPolicy: ConnectionPolicy,
requestOptions: httpsTypes.RequestOptions,
requestOptions: https.RequestOptions,
body: Body
): Promise<Response<any>> {
return new Promise<Response<any>>((resolve, reject) => {
Expand Down

0 comments on commit ea9c01f

Please sign in to comment.