UserManagementClient.PostUserAsync

I’m submitting a…

  • [ ] Regression (a behavior that stopped working in a new release)
  • [x] Bug report
  • [ ] Performance issue
  • [ ] Documentation issue or request

Current behavior

When calling PostUserAsync on the UserManagementClient it results in a SquidexManagementException but with a status code of 200.
So, the request went fine, user is created but it throws an exception.
Can work around it by catching the exception like so:

catch (SquidexManagementException sme) when (sme.StatusCode == 200)
{
     var user = JsonConvert.DeserializeObject<UserDto>(sme.Response);
     ...
}

Expected behavior

No exception is thrown.

Minimal reproduction of the problem

var request = new CreateUserDto
{
    Email = "test@acme.com",
    Password = "a1b@c#Def",
    DisplayName = "Test"
};

var result = await userManagementClient.PostUserAsync(request);

Environment

  • [ ] Self hosted with docker
  • [ ] Self hosted with IIS
  • [ ] Self hosted with other version
  • [ ] Cloud version
  • [x] Client Library

Version: 10.1.0

Thanks. I will have a look. I guess the API spec is just wrong and therefore it generates the wrong code.

I tested it locally and it works fine. I think this is a Squidex problem that is already fixed.

When I have added the user management endpoint to OpenAPI (which is the base for the generated code) I have also changed the response code from 200 to 201. Therefore the request fails.

I have pushed a new version of the client library which is more tolerant with 200 / 201 status codes.

2 Likes

Thanks Sebastian for the quick response. I test with the new version of the client library and it works fine now.

2 Likes