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

added delete and testing connection functionality for FR #126

Merged
merged 3 commits into from
Jun 17, 2024

Conversation

AnikaAgiwal2711
Copy link
Collaborator

@AnikaAgiwal2711 AnikaAgiwal2711 commented Jun 14, 2024

Description

A few sentences describing the overall goals of the pull request's commits.

GitHub Issues

GitHub Issue #
dell/csm#1283

Checklist:

  • I have performed a self-review of my own code to ensure there are no formatting, vetting, linting, or security issues
  • I have verified that new and existing unit tests pass locally with my changes
  • I have not allowed coverage numbers to degenerate
  • I have maintained at least 90% code coverage
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • Backward compatibility is not broken

How Has This Been Tested?

image
image (7)

@adarsh-dell
Copy link
Contributor

Hi @AnikaAgiwal2711 , Is there any github issue associated with this PR?

@AnikaAgiwal2711
Copy link
Collaborator Author

Yes added

@adarsh-dell
Copy link
Contributor

Hello @AnikaAgiwal2711,

I have reviewed the code and have a few suggestions for future improvements:

  1. Consider refactoring the logic into a reusable function for setting headers and handling cookies:

    req.Header.Set("Authorization", "Bearer "+gc.token)
    if err := setRequestHeaders(req, gc.host); err != nil {
        return fmt.Errorf("Error while handling headers and cookies: %s", err)
    }
    
    client := gc.http
    httpResp, err := client.Do(req)
    if err != nil {
        return err
    }
    
    if httpResp.StatusCode != http.StatusNoContent {
        return fmt.Errorf("Error connecting to the source location. Please check the credentials.")
    }
    
    if err := storeCookie(httpResp.Header, gc.host); err != nil {
        return fmt.Errorf("Error while storing cookie: %s", err)
    }
    
    return nil
  2. Consider defining these endpoints as constants:

    const (
        FirmwareRepositoryEndpoint = "/Api/V1/FirmwareRepository/"
        ConnectionEndpoint         = "/Api/V1/FirmwareRepository/connection"
    )

Please let me know if you have any questions or further suggestions.

Thanks,
Adarsh

Copy link
Contributor

@adarsh-dell adarsh-dell left a comment

Choose a reason for hiding this comment

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

LGTM.

@AnikaAgiwal2711 AnikaAgiwal2711 merged commit 26a7b35 into main Jun 17, 2024
4 checks passed
@shanmydell shanmydell deleted the fr-bug-fixes branch October 16, 2024 05:22
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.

3 participants