Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get archive should use RawAPIResponse #64

Merged
merged 1 commit into from
Aug 25, 2021
Merged

Conversation

yahavi
Copy link
Contributor

@yahavi yahavi commented Aug 23, 2021

The response of /api/1.0/projects/{projectKey}/repos/{repositorySlug}/archive is a raw zip, tar, or tgz. Therefore trying to decode it to APIResponse may fail:

// The following line returns an error:
err := json.NewDecoder(r.Body).Decode(&response.Values)

I got the following error when trying to download a tar.gz file:

invalid character '\x1f' looking for beginning of value

The solution that resolved the issue for me is to use RawAPIResponse.

@codecov
Copy link

codecov bot commented Aug 23, 2021

Codecov Report

Merging #64 (be1a0d5) into master (7d616f7) will increase coverage by 1.00%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #64      +/-   ##
==========================================
+ Coverage   58.52%   59.53%   +1.00%     
==========================================
  Files           5        5              
  Lines        7747     8021     +274     
==========================================
+ Hits         4534     4775     +241     
- Misses       2211     2242      +31     
- Partials     1002     1004       +2     
Impacted Files Coverage Δ
default_api.go 60.43% <0.00%> (+1.10%) ⬆️
configuration.go 50.00% <0.00%> (-7.15%) ⬇️
webhook.go 0.00% <0.00%> (ø)
api_response.go 43.85% <0.00%> (+0.18%) ⬆️
api_client.go 38.42% <0.00%> (+2.46%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7d616f7...be1a0d5. Read the comment docs.

@gfleury
Copy link
Owner

gfleury commented Aug 25, 2021

Hey thanks for contributing! LGTM

@gfleury gfleury merged commit bec68b5 into gfleury:master Aug 25, 2021
@yahavi yahavi deleted the get-archive branch August 27, 2021 05:59
@yahavi yahavi restored the get-archive branch August 27, 2021 05:59
@yahavi yahavi deleted the get-archive branch August 27, 2021 05:59
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.

None yet

2 participants