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

Sample: jsonwebtoken_roleauth_DMVC VCL client makes wrong assumption JSON / HTML #766

Open
jasonjac2 opened this issue Aug 7, 2024 · 0 comments

Comments

@jasonjac2
Copy link

In the example: "Get Protected Resource" button
image

gets the same /admin/role1 endpoint, but it implies the first uses the JSON route and hte second one text/html route.

I think both use the text/html route.
{ Getting JSON response } doesn't set the lclient.accept, but the comment implies it is set to JSON.

{ Getting HTML response } explicitly sets the lclient.lClient.Accept('text/html')

To demonstrate:
Run the VCL client outside of the IDE.

Load the JWTRoleAutServer project
Add a breakpoint to:
procedure TAdminController.OnlyRole1;
and
procedure TAdminController.OnlyRole1EmittingJSON;

based on the calling code, I think it should call the JSON only, then the text/html on. IN fact it calls the
text/html one twice.

To make it work as expected you could assign the accept explitcitly.
lResp := lClient.Accept('application/json').Get('/admin/role1');

It just means the default is text/html, not JSON, not a biggy, just incorrect in the example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant