Skip to content

Refactor adapter GET, and add adapter POST method for push - #137

Draft
Tom-Kingstone wants to merge 3 commits into
developfrom
HTTP_Toolkit-#134-AddPOSTAndRefactorGET
Draft

Tom-Kingstone wants to merge 3 commits into
developfrom
HTTP_Toolkit-#134-AddPOSTAndRefactorGET

Conversation

@Tom-Kingstone

@Tom-Kingstone Tom-Kingstone commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

NOTE: Depends on

Issues addressed by this PR

Closes #134
Closes #72

Simple attempt to make this adapter more usable from ASP.NET and Aspire applications (i.e. use this adapter as an API client).
As this is only for GET and POST requests directed through the adapter this shouldn't affect other toolkits
This also fixes #72

changers to adapter constructors:

  • The original constructor still exists and the adapter performs in the same way as before if this constructor is used (default HTTP client, use the Base URI from GetRequests)
  • Added constructor for specifying a base address, which creates a default http client with the given base address
  • Added constructor that directly accepts a http client mainly for ease of use with dependency injection.

Adapter property: HttpClient, allows an application to directly send requests with an already configured client if the existing adapter functionality isn't enough.

Changes to GET:

  • Old way of using the get request should be almost identical, only that it lets the BHoM serialiser do the json check which raises a BHoM error log instead of simply returning the response.
  • Added HttpPullConfig which adds the ability to specify to not try to convert to BHoM if the content-type of the response isn't application/bhom, which will just return the response content as a string instead (so a different json serialiser can be used if necessary).

New POST:

  • Basically allows pushing BHoM objects to an endpoint. This requires the HttpPushConfig to work properly to specify the uri to post to.
  • Response will be deserialised to BHoM objects if the content-type is set to application/bhom or the config specifies to try force convert to BHoM objects, otherwise it returns the response string.
  • Config setting to allow pushing the object as a list if there is only one object. Default is to push single objects if there is only one object.

Test files

TODO: probably will make a simple API to test this locally.

Changelog

Additional comments

@Tom-Kingstone
Tom-Kingstone requested a review from adecler October 15, 2026 11:28
@Tom-Kingstone Tom-Kingstone self-assigned this Oct 15, 2026
@Tom-Kingstone Tom-Kingstone added type:feature status:WIP PR in progress and still in draft, not ready for formal review labels Oct 15, 2026
@Tom-Kingstone
Tom-Kingstone force-pushed the HTTP_Toolkit-#134-AddPOSTAndRefactorGET branch from 7dc1a29 to bdd9d0f Compare October 15, 2026 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:WIP PR in progress and still in draft, not ready for formal review type:feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make this toolkit/adapter more versatile and available for ASP.NET/web tools. BatchRequest not working as expected

1 participant