Skip to content

Conversation

@paulpopus
Copy link
Contributor

Closes #2

Dependant on #4

In this PR I am:

  • Adding new jest tests for more coverage of the get functions on the client
  • Looking to fix the error 500 when using the client on getWebsiteStats

@paulpopus paulpopus marked this pull request as ready for review August 19, 2023 13:54
Copy link
Contributor

@mikecao mikecao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just have a question.

log(`GET ${dest}`);

return get(dest, undefined, this.getHeaders(headers));
return get(dest, undefined, { ...this.getHeaders(headers), ...{ 'Content-Type': undefined } });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to override content type here? The default is application/json.

Copy link
Contributor Author

@paulpopus paulpopus Aug 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my testing, keeping the Content-Type header on get requests to the API resulted in error 500.

But here in the next-basics package you can see it's being included by default https://github.com/umami-software/next-basics/blob/master/src/client/request.ts#L14C17-L14C17

Admittedly I haven't re-tested since the new update that provides better information from the API and I couldn't replicate the bug with a manually written fetch request so I assume that header is the sole problem here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikecao I just retested without the header and it still results in just an error 500 with the latest API version.

@mikecao mikecao merged commit b2d20bb into umami-software:master Sep 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Website stats endpoint returns 500 error

2 participants