Open lipkau opened 4 years ago
I agree. This would also be a good place to implement retry logic on common HTTP failures due to connection issues.
@lipkau Do you have any good examples of this I could steal, er, use?
In my projects, I:
Invoke-WebRequest
(example) which makes mocking tests easier and abstracts the logic of Authorization headers as they differ between PSv5- and PSv6+Invoke-Method
(example) which does the heavy lifting for:
try {} catch {}
block for handling 400+ status codes)
I strongly recommend having a custom proxy function for
Invoke-WebRequest
or having an internal function for the module to use for all requests. that way, you can dump all of the internals (baseurl, headers, pagination, etc) into one place and you have little refactoring in the public commands when you want to refactor internals or how calls are executedLet me know if you are interested in a PR for this.