Skip to content

java.lang.IllegalStateException: closed #22

Open
@wolfchkov

Description

@wolfchkov

This error occur when read okhttp3.response.body() more then one time, because it is stream, after first read it is closing.

.....
onResponse: (call, response) => {
   let body;
   try {
       body = JSON.parse(response.body().string()); //error with parse JSON
   } catch (e) {
       body = response.body().string(); //reading body second time,  crash 
   }
.....

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions