Skip to content

Add an HttpStack for Axios #570

Open
@SpecLad

Description

@SpecLad

Is your feature request related to a problem? Please describe.
In our project we mostly use Axios for making HTTP queries, with some default settings configured globally (e.g. default HTTP headers). We also use tus-js-client, but since it uses its own HTTP stack, we have to replicate the default Axios settings into their tus-js-client equivalents. This causes code duplication, and it's easy to forget to replicate a setting, which leads to divergent behavior.

Describe the solution you'd like
It would be nice if I could write something like this and have tus-js-client work through Axios:

import Axios from 'axios';

const upload = new tus.Upload(file, { httpStack: tus.AxiosHttpStack(Axios), ... });

// or
const axiosInstance = Axios.create({ ... });
const upload = new tus.Upload(file, { httpStack: tus.AxiosHttpStack(axiosInstance ), ... });

That way, all Axios settings would automatically be applied.

Describe alternatives you've considered
I'm aware that I could just implement this AxiosHttpStack on my side. However, Axios is a popular library, so I think many users could find this useful if it was included in tus-js-client.

Can you provide help with implementing this feature?
In principle, yes, although I don't know when I'll be able to get around to it.

Additional context
N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions