As you can see in _gen_response, the username is already encoded there. The problem lies in the digest_uri, which is not encoded, causing the join to fail. I'll create a proper test for this, along with a corresponding fix.