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

Add User-agent for repo-plugins api calls #2722

Merged
merged 7 commits into from
Jan 9, 2024
Merged

Conversation

gururajsh
Copy link
Member

@gururajsh gururajsh commented Jan 4, 2024

Where this PR should be backported?

  • main - all changes should by default start here
  • v8
  • v7

Description of the Change

cf repo-plugins command is erroring with Logged errors: Invalid json data from 'CF-Community' - invalid character '<' looking for beginning of value. It seems https://plugins.cloudfoundry.org/list endpoint is expecting a user agent to be set. This PR adds that.

Why Is This PR Valuable?

Fixes a bug.

Applicable Issues

List any applicable GitHub Issues here

How Urgent Is The Change?

Is the change urgent? If so, explain why it is time-sensitive.

Other Relevant Parties

Who else is affected by the change?

a-b
a-b previously requested changes Jan 4, 2024
Copy link
Member

@a-b a-b left a comment

Choose a reason for hiding this comment

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

Please add tests

moleske and others added 3 commits January 4, 2024 10:55
- would be nice to use command.config but we couldn't see an easy way to thread it

Co-authored-by: david alvarado <alvaradoda@vmware.com>
- The reason it is checking NotTo(Equal(...)) is because the default user agent "Go-http-client/1.1" is being blocked by the webserver

Co-authored-by: david alvarado <alvaradoda@vmware.com>
Copy link
Member

@a-b a-b left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@ccjaimes ccjaimes left a comment

Choose a reason for hiding this comment

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

LGTM

@ccjaimes ccjaimes merged commit 8d19f9f into cloudfoundry:main Jan 9, 2024
11 of 13 checks passed
moleske added a commit that referenced this pull request Jan 9, 2024
* Add user agent info for plugin api calls

* Remove comment

* Edit error message

* Use same user agent as api/plugin/client.go

- would be nice to use command.config but we couldn't see an easy way to thread it

Co-authored-by: david alvarado <alvaradoda@vmware.com>

* Add test

- The reason it is checking NotTo(Equal(...)) is because the default user agent "Go-http-client/1.1" is being blocked by the webserver

Co-authored-by: david alvarado <alvaradoda@vmware.com>

* Clean up deprecation and some warnings and regenerate fake_plugin_repo as we made changes

---------

Co-authored-by: M. Oleske <moleske@pivotal.io>
Co-authored-by: david alvarado <alvaradoda@vmware.com>
Co-authored-by: Al Berez <a-b@users.noreply.github.com>
moleske added a commit that referenced this pull request Jan 9, 2024
* Add user agent info for plugin api calls

* Remove comment

* Edit error message

* Use same user agent as api/plugin/client.go

- would be nice to use command.config but we couldn't see an easy way to thread it

Co-authored-by: david alvarado <alvaradoda@vmware.com>

* Add test

- The reason it is checking NotTo(Equal(...)) is because the default user agent "Go-http-client/1.1" is being blocked by the webserver

Co-authored-by: david alvarado <alvaradoda@vmware.com>

* Clean up deprecation and some warnings and regenerate fake_plugin_repo as we made changes

---------

Co-authored-by: M. Oleske <moleske@pivotal.io>
Co-authored-by: david alvarado <alvaradoda@vmware.com>
Co-authored-by: Al Berez <a-b@users.noreply.github.com>
moleske added a commit that referenced this pull request Jan 16, 2024
* Add user agent info for plugin api calls

* Remove comment

* Edit error message

* Use same user agent as api/plugin/client.go

- would be nice to use command.config but we couldn't see an easy way to thread it



* Add test

- The reason it is checking NotTo(Equal(...)) is because the default user agent "Go-http-client/1.1" is being blocked by the webserver



* Clean up deprecation and some warnings and regenerate fake_plugin_repo as we made changes

---------

Co-authored-by: Shwetha Gururaj <gururajsh@vmware.com>
Co-authored-by: david alvarado <alvaradoda@vmware.com>
Co-authored-by: Al Berez <a-b@users.noreply.github.com>
moleske added a commit that referenced this pull request Jan 16, 2024
* Add user agent info for plugin api calls

* Remove comment

* Edit error message

* Use same user agent as api/plugin/client.go

- would be nice to use command.config but we couldn't see an easy way to thread it



* Add test

- The reason it is checking NotTo(Equal(...)) is because the default user agent "Go-http-client/1.1" is being blocked by the webserver



* Clean up deprecation and some warnings and regenerate fake_plugin_repo as we made changes

---------

Co-authored-by: Shwetha Gururaj <gururajsh@vmware.com>
Co-authored-by: david alvarado <alvaradoda@vmware.com>
Co-authored-by: Al Berez <a-b@users.noreply.github.com>
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

5 participants