Skip to content

🧹 Support multiple HTTP Body Types #85

@mathew-odwyer

Description

@mathew-odwyer

Checklist

  • I have not removed the 🧹 emoji from the title.
  • I have confirmed that this task is not already tracked under another tech debt or refactor issue.
  • This does not represent a user-facing feature request or bug report, but an internal improvement.
  • For maintainers: I have updated the projects and milestones if needed.

Description

Currently obj_http supports two body types: JSON and XML. However, the system in place to detect this was hacked together quickly to prepare for map loading (see here). We should instead create a simple struct that will be used to parse particular HTTP body types (like Sidorakh did with http.gml).

Impact

This will ensure that we can easily add new content parsers as the projects requirements grow. Realistically, this will be a much better design decision overall and will cleanup the Async HTTP event in obj_http.

Proposed Approach

  1. Create a struct that is used to parse incoming data.
  2. Essentially, just a kvp used to fetch the correct parser
  3. By default, we should attempt to fallback to JSON, log a warning and if that fails, throw a Struct.HttpError.

Risks or Challenges

  • Should we even attempt to fallback to JSON or should we assume that if the data returned is not in a valid format then it is invalid and an error should be thrown?

Metadata

Metadata

Assignees

Labels

gm-networktech debtThis issue relates to extra work being required.

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions