Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditionally import cross-fetch with polyfill - Issue #197 #198

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ DEBUG environment variable, or use `fhir-kit-client:*` to enable both.
$ DEBUG=fhir-kit-client:* node smart-launch.js
```

## Disabling Fetch Polyfill

The optional polyfill in the cross-fetch package can be disabled by setting the environmnt variable FETCH_POLYFILL=disable.

## Contributing

FHIRKit Client is an open source Node.js FHIR client library that welcomes
Expand Down
8 changes: 7 additions & 1 deletion lib/http-client.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
/* eslint-disable global-require */
/* global Request, Headers */
require('es6-promise').polyfill();
require('cross-fetch/polyfill');

if (process.env.FETCH_POLYFILL && process.env.FETCH_POLYFILL === 'disable') {
require('cross-fetch');
} else {
require('cross-fetch/polyfill');
}

const { logRequestError, logRequestInfo, logResponseInfo } = require('./logging');

Expand Down
Loading