Skip to content

Bug: Http plugin fails when request body contains a string that is not valid JSON #196

@krisbitney

Description

@krisbitney

When the body of a post request is not a valid JSON string, I encounter an exception. However, the HTTP interface schema says Request can contain any string.

The exception:

"PluginWrapper: invocation exception encountered.\nexception: \"Error parsing JSON: `expected value at line 1 column 1`\""`>

The invocation that produces the exception:

@Test
fun post() {
    val result: InvokeResult<Types.Response?> = client.invoke(
        uri = uri,
        method = "post",
        args = Types.ArgsPost(
            url = "https://httpbin.org/post",
            request = Types.Request(
                body = "Hello World!",
                responseType = Types.ResponseType.TEXT
            )
        )
    )

    assertNull(result.exceptionOrNull())
    assertEquals(200, result.getOrThrow()?.status)
}

Additional context:
https://discord.com/channels/796821176743362611/1010304976406454323/1138196489143857277

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions