Skip to content

Feature Request: Return response from server during failed create step #212

@cwalo

Description

@cwalo

I'm integrating TUSKit into the supabase-swift package for built-in support for resumable uploads. When creating an upload, if access controls are not configured correctly (or an invalid api key is provided), the TUSClient will return couldNotCreateFileOnServer, with no other details. If I add the didReceive data delegate method to SessionDataDelegate and print the response, you'll see a much more informative response.

func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) {
    print(String(data: data, encoding: .utf8) ?? "No data")
}

In this case, I provided an invalid API key.
{"statusCode":"403","code":"AccessDenied","error":"Unauthorized","message":"Invalid Compact JWS"}

Similarly, uploading a duplicate file without x-upsert: true will return a 409 and print The resource already exists.

It would be helpful to consumers to provide the statusCode and body (if there is one) during this step to better diagnose upload issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions