elysiajs / eden

Fully type-safe Elysia client
MIT License
147 stars 37 forks source link

Duplicated values when passing uppercase values for headers #100

Open mrctrifork opened 3 months ago

mrctrifork commented 3 months ago

If you create the client like so:

treaty<App>('http://localhost:4000', {
  onRequest: (path, options) => {
     const token = localStorage.get('token');
    if( token ) {
      return { 
        headers: {
            Authorization: `Bearer ${token}`
        }
      }
    }
  }
})

Ends up sending the request as follows:

GET /
...headers
authorization: Bearer token, Bearer token

If you send the header in lowercase it works as expected