Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trackDetail Property Type Inconsistent #3

Open
Whobeu opened this issue Feb 8, 2019 · 0 comments
Open

trackDetail Property Type Inconsistent #3

Whobeu opened this issue Feb 8, 2019 · 0 comments

Comments

@Whobeu
Copy link

Whobeu commented Feb 8, 2019

Had an issue with returned data for an item I tracked. Usually I get multiple detail records back in the trackDetail property as an array (typeof "object"). However, I tracked an item that had only one trackDetail record and the property was typeof "string" which caused an issue as I was using shift() to step through the records. While it is simple enough to check the property type and handle it accordingly, I think the property should always be returned as an array even if it contains only one element. In my, case it was only a half hour before the postal service added another detail entry and the property became an array.

This is JSON that was returned. First is for the single record:

"trackInfo": {
    "trackSummary": "Your item arrived at the Post Office at 11:41 am...",
    "trackDetail": "Arrived Shipping Partner Facility, USPS Awaiting Item, February 8, 2019, ..."
}

Multiple records:

"trackInfo": {
    "trackSummary": "Your item arrived at the Post Office at 11:41 am...",
    "trackDetail": [
        "Accepted at USPS Destination Facility, February 8, 2019, 10:26 am, ...",
        "Arrived Shipping Partner Facility, USPS Awaiting Item, February 8, 2019, ..."
     ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant