nozzlegear / ShopifySharp

ShopifySharp is a .NET library that helps developers easily authenticate with and manage Shopify stores.
https://nozzlegear.com/shopify-development-handbook
MIT License
742 stars 309 forks source link

Deprecate ShopifyService.PrepareRequest and replace with an overridable `ShopifyService.BuildRequestUri` #983

Closed nozzlegear closed 9 months ago

nozzlegear commented 9 months ago

This change is aimed at making it easier to control the final url for API requests when you need to create your own Shopify service class, and that service does not send requests to the two paths that were built by ShopifyService.PrepareRequest.

(This was an actual painpoint of mine when I had to implement my own version of the PartnerService in a different project before we added it to ShopifySharp.)

This change also makes testing ShopifySharp services much easier in situations where you want to stub calls to the Shopify API. You should now be able to completely control where the requests are going to be sent, so instead of the OrderService sending tests to example.myshopify.com/admin/api/2023-10/orders.json you can have your stub send requests to localhost:whatever/shopify/stub/orders.json.