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

SALTO-6867 Fetch bot builder #6751

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

adfineberg
Copy link
Contributor

@adfineberg adfineberg commented Nov 13, 2024

This is still missing a filter to order the paths, some references and error handling for the graphql response


Additional context for reviewer


Release Notes:
Replace me with a short sentence that describes the effect of this change on Salto users


User Notifications:
Replace me with a short sentence that describes changes that will appear in NaCls and are not caused by user actions (e.g. a new annotation, field values that are converted to references, etc). Hidden changes should not be listed.

@coveralls
Copy link

coveralls commented Nov 13, 2024

Coverage Status

coverage: 93.099% (-0.7%) from 93.8%
when pulling 9f709cf on adfineberg:SALTO-6867-csrf-client
into a510e7b on salto-io:main.

@adfineberg adfineberg force-pushed the SALTO-6867-csrf-client branch from 9bd6ae5 to 0e08127 Compare November 14, 2024 08:23
Copy link
Contributor

@edenhassid edenhassid left a comment

Choose a reason for hiding this comment

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

looks good! 🔥 added some small comments

}
const headers = {
...params.headers,
'Content-Type': 'application/json',
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this always application/json ?

} catch (e) {
if (e.response?.status === 400) {
log.debug('Got 400, trying to get new CSRF token')
this.csrfToken = await this.getCsrfToken()
Copy link
Contributor

Choose a reason for hiding this comment

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

is expired csrf token is the only reason for a 400 status?

Copy link
Contributor

Choose a reason for hiding this comment

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

also, if this.getCsrfToken() fails it throws an error, but then we won't see the original error that was caught in this block

endpoints: {
default: {
post: {
// This is for the graphql endpoint, which is readonly for fetch. It allows it to be used in fetch
Copy link
Contributor

@netama netama Nov 17, 2024

Choose a reason for hiding this comment

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

then maybe set it specifically for the graphql path? or are there multiple?
(is there a reason to define the clients in a separate PR from the fetch definitions? there's probably no harm in adding it, but there isn't enough context here to actually review the only thing using it - even if these are in separate PRs, probably worth having the next one available for review?)

@adfineberg adfineberg force-pushed the SALTO-6867-csrf-client branch from 9f709cf to 414cd9f Compare December 26, 2024 12:41
@adfineberg adfineberg changed the title SALTO-6867 Add csrf client for graphql requests SALTO-6867 Fetch bot builder Dec 26, 2024
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.

4 participants