As we reevaluate how to best support and maintain Staging Ref in the future, we encourage development teams using this environment to highlight their use cases in the following issue: https://gitlab.com/gitlab-com/gl-infra/software-delivery/framework/software-delivery-framework-issue-tracker/-/issues/36.

Skip to content
Snippets Groups Projects
Commit 54deaab0 authored by Vasilii Iakliushin's avatar Vasilii Iakliushin
Browse files

Extract "/ssh-upload-pack" into constant

parent a02fb7a8
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -14,7 +14,10 @@ var httpClient = &http.Client{
Transport: client.NewTransport(client.DefaultTransport()),
}
const repoUnavailableErrMsg = "Remote repository is unavailable"
const (
repoUnavailableErrMsg = "Remote repository is unavailable"
sshUploadPackPath = "/ssh-upload-pack"
)
// Client represents a client for interacting with Git repositories.
type Client struct {
Loading
Loading
@@ -58,7 +61,7 @@ func (c *Client) UploadPack(ctx context.Context, body io.Reader) (*http.Response
// SSHUploadPack sends a SSH Git fetch request to the server.
func (c *Client) SSHUploadPack(ctx context.Context, body io.Reader) (*http.Response, error) {
request, err := http.NewRequestWithContext(ctx, http.MethodPost, c.URL+"/ssh-upload-pack", body)
request, err := http.NewRequestWithContext(ctx, http.MethodPost, c.URL+sshUploadPackPath, body)
if err != nil {
return nil, err
}
Loading
Loading
Loading
Loading
@@ -181,7 +181,7 @@ func setup(t *testing.T) *Client {
},
},
{
Path: "/ssh-upload-pack",
Path: sshUploadPackPath,
Handler: func(w http.ResponseWriter, r *http.Request) {
require.Equal(t, customHeaders["Authorization"], r.Header.Get("Authorization"))
require.Equal(t, customHeaders["Header-One"], r.Header.Get("Header-One"))
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment