-
Notifications
You must be signed in to change notification settings - Fork 47
Feature: Add request hooks #36
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ed7968c
Add request enchancers
igoroctaviano 939c60c
Pass metadata info
igoroctaviano ce37d7e
Update naming and documentation
igoroctaviano a6f85ca
Add unit tests
igoroctaviano 94d33c5
CR Updates
igoroctaviano 6fa48f1
CR Updates: add runtime checks
igoroctaviano 99d0f6b
Merge branch 'master' of github.com:dcmjs-org/dicomweb-client into fe…
igoroctaviano 4b9b26a
cr update: add examples
igoroctaviano b7443d9
Merge branch 'master' of github.com:dcmjs-org/dicomweb-client into fe…
igoroctaviano 3eb39eb
CR Updates
igoroctaviano File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| <!DOCTYPE HTML> | ||
| <html> | ||
| <head> | ||
| <link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"> | ||
| </head> | ||
| <body> | ||
| <div class="container"> | ||
| <h1> | ||
| Example: Request Hooks | ||
| </h1> | ||
| <hr> | ||
| <pre> | ||
| const options = { | ||
| url: "https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs", | ||
| requestHooks: [ | ||
| (request, metadata) => { | ||
| const requestMetadata = document.createElement('div'); | ||
| requestMetadata.innerHTML = `Method: ${metadata.method} URL: ${metadata.url}`; | ||
| document.getElementById('requests').append(requestMetadata); | ||
| return request; | ||
| } | ||
| ], | ||
| }; | ||
| </pre> | ||
| <hr> | ||
| <h3>Requests:</h3> | ||
| <h5>(Logged using request hooks)</h5> | ||
| <pre id='requests'></pre> | ||
| <hr> | ||
| <div class="row"> | ||
| <div id='contents' class="col-xs-12"> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </body> | ||
|
|
||
| <!-- include the cornerstone library --> | ||
| <script src="../build/dicomweb-client.js"></script> | ||
| <script> | ||
| if (!window.DICOMwebClient) { | ||
| console.warn('Failed to load dicomweb-client from build directory. Using unpkg instead.'); | ||
| document.write('<script src="https://unpkg.com/dicomweb-client">\x3C/script>') | ||
| } | ||
| </script> | ||
|
|
||
| <script> | ||
| const dwc = DICOMwebClient.api.DICOMwebClient; | ||
| const options = { | ||
| url: "https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs", | ||
| requestHooks: [ | ||
| (request, metadata) => { | ||
| const requestMetadata = document.createElement('div'); | ||
| requestMetadata.innerHTML = `Method: ${metadata.method} URL: ${metadata.url}`; | ||
| document.getElementById('requests').append(requestMetadata); | ||
| return request; | ||
| } | ||
| ], | ||
| }; | ||
|
|
||
| const dicomweb = new dwc(options) | ||
| const studyInstanceUID = '1.2.392.200140.2.1.1.1.2.799008771.2156.1519721160.421' | ||
| const promise = dicomweb.retrieveStudyMetadata({studyInstanceUID}); | ||
|
|
||
| promise.then(studyMetadata => { | ||
| const div = document.getElementById('contents'); | ||
| div.innerText = JSON.stringify(studyMetadata, null, 2); | ||
| console.log(studyMetadata); | ||
| }, error => { | ||
| throw new Error(error); | ||
| }); | ||
| </script> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.