diff --git a/README.md b/README.md index 15390d4..e6c24fc 100644 --- a/README.md +++ b/README.md @@ -348,12 +348,6 @@ Middleware functions accept two arguments - the current request and a function t **P.S.** The middleware array is exposed on `request.middleware`, which allows you to clone requests and omit middleware - for example, using `request.middleware.slice(request.middleware.indexOf(currentFn))`. This is useful, as the pre and post steps of previous middleware attach before `currentFn` is executed. -#### Checking The Environment - -```js -popsicle.browser //=> true -``` - #### Transportation Layers Creating a custom transportation layer is just a matter creating an object with `open`, `abort` and `use` options set. The open method should set any request information required between called as `request._raw`. Abort must abort the current request instance, while `open` must **always** resolve to a promise. You can set `use` to an empty array if no plugins should be used by default. However, it's recommended you keep `use` set to the defaults, or as close as possible using your transport layer. diff --git a/lib/common.ts b/lib/common.ts index e19c6e6..4e6804b 100644 --- a/lib/common.ts +++ b/lib/common.ts @@ -31,7 +31,6 @@ export function defaults (defaultsOptions: DefaultsOptions) { } } -export const browser = !!process.browser export const request = defaults({}) export const get = defaults({ method: 'get' }) diff --git a/lib/test/index.ts b/lib/test/index.ts index 7f3c5f4..a6c70fe 100644 --- a/lib/test/index.ts +++ b/lib/test/index.ts @@ -198,7 +198,7 @@ test('request headers', function (t) { }) }) - if (!popsicle.browser) { + if (!process.browser) { t.test('send a custom user agent header', function (t) { return popsicle.request({ url: REMOTE_URL + '/echo/header/user-agent', @@ -905,7 +905,7 @@ test('override request mechanism', function (t) { }) }) -if (!popsicle.browser) { +if (!process.browser) { test('redirect', function (t) { t.test('should follow 302 redirect with get', function (t) { return popsicle.request(REMOTE_URL + '/redirect') @@ -1009,7 +1009,7 @@ if (!popsicle.browser) { }) } -if (!popsicle.browser) { +if (!process.browser) { test('https reject unauthorized', function (t) { t.plan(1)