Skip to content

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

Closed
@jasonjac2

Description

@jasonjac2

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.

Metadata

Metadata

Assignees

Labels

acceptedIssue has been accepted and inserted in a future milestonetask

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions