Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Access WWW.text on Error

Discussion in 'Editor & General Support' started by akasurreal, Jun 25, 2013.

  1. akasurreal

    akasurreal

    Joined:
    Jul 17, 2009
    Posts:
    441
    I am using WWW to make REST API requests. When certain requests fail, they return a 4xx status code but also return a JSON content body with detailed error information. This information is vital, but when I try to access the content through WWW.text or WWW.bytes I get:

    You are trying to load data from a www stream which had the following error when downloading.
    400 Bad Request

    I have checked the request in a web browser and yes, its returning a 4xx error, but its still also returning the JSON data with more info. Is there any way to get at this info and I need it to work on iOS too. I know there are 3rd party WWW replacements like UniWeb but hoping to not need that for various reasons.

    Thanks!
     
  2. oferei

    oferei

    Joined:
    Dec 1, 2012
    Posts:
    36
    Exact same problem here. It seems like a bug to me.
     
  3. nah0y

    nah0y

    Joined:
    Apr 4, 2011
    Posts:
    74
  4. akasurreal

    akasurreal

    Joined:
    Jul 17, 2009
    Posts:
    441
    FYI, I have opened a discussion about this and other issues regarding the WWW class in Unity Beta group, and it sounds like they are planning to eventually address them all at some point. The issue thus far has been offering feature consistency to WebPlayer builds because of limitations with NPAPI.
     
  5. TheDemiurge

    TheDemiurge

    Joined:
    Jul 26, 2010
    Posts:
    42
    Any word on this since July? Trying to deal with AWS via HTTP requests and I'm bad enough with that stuff even without missing info I need to help me figure out what I'm doing :/
     
  6. Mikeysee

    Mikeysee

    Joined:
    Oct 14, 2013
    Posts:
    155
    Any progress on this? Or whats the standard workaround? Its really really annoying!
     
  7. akasurreal

    akasurreal

    Joined:
    Jul 17, 2009
    Posts:
    441
    Anyone know if Unity 5 finally has a proper WWW class?
     
  8. patman

    patman

    Joined:
    Jul 4, 2012
    Posts:
    8
    I have recently had this problem. I'm going to try the BestHTTP plugin from the Asset Store. One of the reviews indicates it allows access to return values even on errors.
     
  9. zarawesome

    zarawesome

    Joined:
    Jul 25, 2014
    Posts:
    7
    This is ridiculous. The specification clearly says "the server should include an entity containing an explanation of the error situation, and whether it is a temporary or permanent condition", and yet there's no way for the client to access that entity because of some absurd assumption on the part of unity's www class.
     
  10. peroon

    peroon

    Joined:
    Nov 18, 2012
    Posts:
    7
    I also want to get www.text on error... (Unity4.6)
     
  11. cowlinator

    cowlinator

    Joined:
    Mar 15, 2012
    Posts:
    69
    Any progress on this? Is there a workaround?
     
  12. akasurreal

    akasurreal

    Joined:
    Jul 17, 2009
    Posts:
    441
    As far as I know, still no official solution, but there are a couple 3rd party WWW tools on asset store that are way more functional like BestHTTP at least.
     
  13. cowlinator

    cowlinator

    Joined:
    Mar 15, 2012
    Posts:
    69
    The Unity 5 changelog states "WWW: Populate .bytes and .text on non-200 response."

    Thank you Unity!!
     
  14. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,559
    did anyone actually see this is working ?