Skip to content

',' or ']' expected, got 'Admin', JSON standard does not allow such tokens, ',' or ']' expected, got 'Admin' #1175

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

Open
naveensabavath opened this issue Feb 13, 2025 · 1 comment

Comments

@naveensabavath
Copy link

naveensabavath commented Feb 13, 2025

hi @arcuri82 Please Reply ASAP

  • The API is returning responses with the Content-Type: " application / problem+json " instead of the expected " application/json ", causing schema validation failures in OpenAPI tests.

  • The JSON response body contains syntax errors (e.g., missing commas, incorrect brackets, or invalid characters).
    
  • Also, It is generating more test cases in Evomaster_faults_Test but nothing in Evomaster_successes_Test ( Sometimes only 2 Test cases Generates )

@test @timeout(60)
public void test_216() throws Exception {

    // Fault200. Received A Response From API That Is Not Valid According To Its Schema. POST:/v1.0/login -> Response Content-Type header 'application/problem+json' does not match any allowed types. Must be one of: [application/json].
    given().accept("*/*")
            .header("Authorization", "Bearer eyJhxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") // BearerAuth
            .header("x-EMextraHeader123", "42")
            .contentType("application/json")
            .body(" {\"productId\":\"lHH\", \"requestType\":\"EVOMASTER\", \"provider\":\"GOOGLE\", \"totp\":\"_EM_2079_XYZ_\", \"organisationId\":\"q3lnU\", \"platformDetails\":{ " + 
                " \"_EM_2080_XYZ_\":[\"_EM_2081_XYZ_\", \"_EM_2082_XYZ_\", \"_EM_2083_XYZ_\"] " + 
                " , " + 
                " \"_EM_2084_XYZ_\":[\"_EM_2085_XYZ_\"] " + 
                " , " + 
                " \"5\":[\"G4G5EGDvQtyXRQj5\", \"{\"664afc3ca589ffa4e7eeda5db\":[\"AP\"]}\"] " +    "  GETTING  SYNTAX ERROR  HERE  "
                " }, \"systemLogin\":false} ")
            .post(baseUrlOfSut + "/v1.0/login?" + 
                "EMextraParam123=_EM_142_XYZ_&" + 
                "mask=_EM_2087_XYZ_")
            .then()
            .statusCode(400)
            .assertThat()
            .contentType("application/problem+json")    //   "   WHY AM IT IS WRITTING PROBLEM + JSON  "
            .body("'type'", containsString("about:blank"))
            .body("'title'", containsString("Bad Request"))
            .body("'status'", numberMatches(400.0))
            .body("'detail'", containsString("Failed to read request"))
            .body("'instance'", containsString("/v1.0/login"))
            .body("'properties'", nullValue());
}
@arcuri82
Copy link
Collaborator

Hi,
EM is correct here. The API is providing a response that is not valid according to its defining OpenAPI schema. You get the error message: Response Content-Type header 'application/problem+json' does not match any allowed types. Must be one of: [application/json].

application/problem+json and application/json are not the same. As a schema fault is detected, the test is put under Evomaster_faults_Test and not under Evomaster_successes_Test

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

No branches or pull requests

2 participants