Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions htsget/htsget.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ func Htsget(args []string, configPath string) error {

// TODO: Add cases for different type of files
// i.e. bam files require the /reads/, replace for vcf
url := htsgetHost + "/reads/" + datasetID + "/" + fileName
url := htsgetHost + "/reads/" + datasetID + "/" + fileName + "?encryptionScheme=C4GH"
if referenceName != "" {
url = url + "?referenceName=" + referenceName
url = url + "&referenceName=" + referenceName
}
method := "GET"
client := &http.Client{}
Expand All @@ -103,7 +103,7 @@ func Htsget(args []string, configPath string) error {
}

req.Header.Add("Authorization", "Bearer "+config.AccessToken)
req.Header.Add("client-public-key", base64publickey)
req.Header.Add("Client-Public-Key", base64publickey)

res, err := client.Do(req)

Expand Down
3 changes: 2 additions & 1 deletion htsget/htsget_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"os"
"path/filepath"
"runtime"
"strings"
"testing"
"time"

Expand All @@ -36,7 +37,7 @@ func TestHtsgetTestSuite(t *testing.T) {

func (s *HtsgetTestSuite) SetupSuite() {
s.httpTestServer = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
switch req.RequestURI {
switch strings.Split(req.RequestURI, "?")[0] {
case "/reads/DATASET0001/htsnexus_test_NA12878_file_not_found", "/s3/DATASET0001/htsnexus_test_NA12878_file_range_not_found.bam.c4gh":
w.WriteHeader(http.StatusNotFound)
_, _ = fmt.Fprint(w, "File not found")
Expand Down
Loading