iexcloud icon indicating copy to clipboard operation
iexcloud copied to clipboard

Endpoints with query parameters in string are broken

Open matthewrankin opened this issue 3 years ago • 5 comments

Endpoints made using a string containing a query parameter (e.g., "/stock/aapl/income/4?period=annual") are not working. The question mark is getting replaced with %3F prior to the endpoint being called.

matthewrankin avatar Dec 10 '21 14:12 matthewrankin

I thought this was fixed in https://github.com/goinvest/iexcloud/pull/95

I added a test for this in https://github.com/goinvest/iexcloud/commit/64bcf08b6e784d94e557d6be7af2dbbe17fd80fb#diff-4dc56e64f310cd8c12bb00f75c09e83f5d875563ea9901788e525487dc6788b3R51

Is this a different issue?

karagog avatar Dec 10 '21 18:12 karagog

There may be more methods that are broken, but right now I can confirm that the following are broken:

func (c Client) AnnualIncomeStatements(ctx context.Context, symbol string, num int) (IncomeStatements, error)
func (c Client) QuarterlyIncomeStatements(ctx context.Context, symbol string, num int) (IncomeStatements, error)

matthewrankin avatar Dec 10 '21 20:12 matthewrankin

I wrote a unit test for annual income statements where I tried to reproduce this issue but I was unable (resulted in https://github.com/goinvest/iexcloud/pull/101). It appears to be working for me. At any rate the PR refactors the code so it doesn't mix the endpoint and query params anymore, so if it was really an issue it should be gone after the PR is merged.

karagog avatar Dec 10 '21 21:12 karagog

@karagog — Are the integration tests working for you?

matthewrankin avatar Dec 10 '21 21:12 matthewrankin

I don't use them right now b/c I don't have a paid account yet. Eventually I will get one, but I've been able to do a lot of development without one so I'm putting it off as long as I can :)

karagog avatar Dec 10 '21 23:12 karagog