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

Performing an interaction on an unknown FHIR resource results in 400, not 404 as per FHIR spec #539

Closed
CarthageKing opened this issue Jan 16, 2017 · 1 comment

Comments

@CarthageKing
Copy link

@CarthageKing CarthageKing commented Jan 16, 2017

Hi,

When performing an interaction against an unknown resource (e.g. [baseurl]/Patent) (i.e. Patient that was misspelled), HAPI will return 400 instead of 404. AEGIS Touchstone thinks FHIR servers should return 404 in these cases, probably because of the following:
http://hl7.org/fhir/2017Jan/http.html#create

404 Not Found - resource type not supported, or not a FHIR end-point

also in http://hl7.org/fhir/2017Jan/http.html#2.44.0.10.1.

I would think that in RestfulServer.determineResourceMethod(), changing "if(resourceBinding==null)" to throw a ResourceNotFoundException instead of an InvalidRequestException should solve this problem.

		} else {
			resourceBinding = myResourceNameToBinding.get(resourceName);
			if (resourceBinding == null) {
				throw new InvalidRequestException("Unknown resource type '" + resourceName + "' - Server knows how to handle: " + myResourceNameToBinding.keySet());
			}
		}

Tested with HAPI 2.2 and master.

Best Regards,

@CarthageKing CarthageKing changed the title Performing an interaction on an unknown FHIR resource results in 400, not 404 as per FHIR spec (2.2) Performing an interaction on an unknown FHIR resource results in 400, not 404 as per FHIR spec Jan 16, 2017
@jamesagnew
Copy link
Owner

@jamesagnew jamesagnew commented Jan 20, 2017

Hi @CarthageKing , thanks for the PR! Looks good, merging it now.

jamesagnew added a commit that referenced this issue Jan 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.