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

Move set path parameter in dispatch class #36

Closed
lscalese opened this issue Oct 19, 2023 · 1 comment
Closed

Move set path parameter in dispatch class #36

lscalese opened this issue Oct 19, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@lscalese
Copy link
Owner

Currently the set path parameter in dispatch class is after the loadrequest call :

ClassMethod getTransaction(ref As %String) As %Status
{
	Set sc = $$$OK
	Try{
		Do ##class(%REST.Impl).%SetContentType($Get(%request.CgiEnvs("HTTP_ACCEPT")))
		If '##class(%REST.Impl).%CheckAccepts("application/json,application/jose,application/octet-stream,text/vnd.graphviz") Do ##class(%REST.Impl).%ReportRESTError(..#HTTP406NOTACCEPTABLE,$$$ERROR($$$RESTBadAccepts)) Quit
		Set requestMessage = ##class(Nuts.ApiServer.Network.requests.getTransaction).%New()
		Do requestMessage.LoadFromRequest(%request)
		Set scValidateRequest = requestMessage.RequestValidate()
		If $$$ISERR(scValidateRequest) Do ##class(%REST.Impl).%ReportRESTError(..#HTTP400BADREQUEST,$$$ERROR(5001,"Invalid requestMessage object.")) Quit
		Set requestMessage.pathref = ref
		Set response = ##class(Nuts.ApiServer.Network.impl).getTransaction(requestMessage)
		Do ##class(Nuts.ApiServer.Network.impl).%WriteResponse(response)
	} Catch(ex) {
		Do ##class(%REST.Impl).%ReportRESTError(..#HTTP500INTERNALSERVERERROR,ex.AsStatus(),$parameter("Nuts.ApiServer.Network.impl","ExposeServerExceptions"))
	}
	Quit sc
}

the line:

Set requestMessage.pathref = ref

should be generated before loadFromRequest like this:

Set requestMessage.pathref = ref
Do requestMessage.LoadFromRequest(%request)
@lscalese lscalese self-assigned this Oct 19, 2023
@lscalese lscalese added the bug Something isn't working label Oct 19, 2023
@lscalese
Copy link
Owner Author

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant