AWS HTTP API - same request but different response in Python Requests vs Dart HTTP AWS HTTP API - same request but different response in Python Requests vs Dart HTTP dart dart

AWS HTTP API - same request but different response in Python Requests vs Dart HTTP


Ok this is resolved now. My issue was in part a massive user-error. I was using a new IDE and when I generated the hardcoded example I provided I was actually still executing the previous file. Stupid, stupid, stupid.

But...

I was able to sort out the actual issue that caused me raise the question in the first place. I found that if you set the content type to "application/json" in the headers, the dart HTTP package automatically appends "; charset=utf-8". Because this value is part of the auth signature, when AWS encodes the values from the header to compare to the user-generated signature, they don't match.

The fix is simply to ensure that when you are setting the header content-type, make sure that you manually set it to "application/json; charset=utf-8" and not "application/json".

Found a bit more discussion about this "bug" after the fact here.