Skip to content

Response.getContent() always returning empty string #361

Closed
@born2snipe

Description

@born2snipe

Version: 7.9.1

Problem

When Response.getContent() is getting called I am always receiving an empty string

Steps to Reproduce

I forked the repo and made a test to expose the problem:

https://github.com/born2snipe/twilio-java/tree/reading-content-always-returning-empty-string

Possible fix

In the Response.getContent() stop checking the available() on the InputStream since it is considered an estimate number of bytes available. Instead, just consume the bytes and store the read bytes into a ByteArrayOutputStream and convert the contents to a String.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions