-
Notifications
You must be signed in to change notification settings - Fork 3k
Return null value from JSON.Parse #1904
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
12 commits
Select commit
Hold shift + click to select a range
179fd73
Return null value from JSON.Parse
danmarshall c6e2434
added ajax tests for 204 No Content
danmarshall 3669375
Merge branch 'master' into patch-1
danmarshall f66c83b
mock the behavior of IE
danmarshall 0d1d347
pascal case class name.
danmarshall fe61805
Merge branch 'master' into patch-1
danmarshall 6d87eb5
Use 'null' instead of '' for JSON.parse
danmarshall 3c661b5
Merge branch 'master' into patch-1
danmarshall f3b08c1
remove empty constructor
danmarshall 691dd2e
Merge branch 'master' into patch-1
danmarshall 6670136
fix(AjaxObservable): return null value from JSON.Parse
danmarshall 4e15603
Merge branch 'patch-1' of https://github.com/danmarshall/rxjs into pa…
danmarshall 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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't
jsonResponseValuehandles status 204? is there possibility to fall back into this overrided method?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On other platforms, yes. This is the override to behave as IE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just pulled down and while trying it, seems this specific (
MockXMLHttpRequestInternetExplorer::defaultResponseValue()) hasn't executed. Maybe I'm missing something?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a scenario where one can write a unit test like this:
The issue is that the IE does not actually provide
'responseType': 'json',so this would be a presumptuous test. That is why when we mock IE that we actually unsetresponseTypeinprivate mockHttp204()That is the reason the MockXMLHttpRequestInternetExplorer overrides both, just in case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
: yes, that I'm aware of.
My question in here is, if overrided
defaultResponseValuedoesn't do any roles in inheritedMockXMLHttpRequestIE, is it necessarily need to do it? test for behavior of IE is fulfilled by response override at line 242, so default case may not be separated / overrideded but just leave as-is to throw directly in line 199 instead. Of course it's for 'just in case' and to be possibly served in further though, I'm seeing inherited class can be simplified.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, if it is used incorrectly, (test respondWith
'responseType': 'json',) this will give a false positive. Basically, my intention was to keep all IE mock behavior inside of the class. Otherwise every test writer has to know how IE behaves.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thanks for clarification. I don't see it as hard blocking issue.