tumblr / TMTumblrSDK

Unopinionated and flexible library for easily integrating Tumblr data into your iOS or OS X application.
http://tumblr.github.com/TMTumblrSDK
Apache License 2.0
432 stars 125 forks source link

Support an array as a top level response object #181

Closed taichino closed 7 months ago

taichino commented 7 months ago

Currently, TMParsedHTTPResponse does not support an array as a top level response object, which means this class cannot handle a response like the following. (JSONDictionary property is always empty dictionary)

{
  "meta": {
    "status": 200,
    "msg": "OK"
  },
  "response": [
    { object 1},
    { object 2}
    ...
  ]
}

After this change, TMParsedHTTPResponse will have either JSONDictionary or JSONArray populated and clients can use either value accordingly.

aerych commented 7 months ago

Should TMResponseParserTests be updated to also have a few tests for an array?

taichino commented 7 months ago

You're right! Just added a test case here https://github.com/tumblr/TMTumblrSDK/pull/181/commits/a415dfdb4a296508125737558a1cbff74ca1d074

@aerych

aerych commented 7 months ago

:shipit:!