Skip to content

Commit 3f7119a

Browse files
authored
fix(core): add accept header to http remote cache get (#33093)
With the Accept header in place during the retrieval of cache, the client always expects an octet-stream from the server. <!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior When the `Accept` header is missing, you might not get the correct data depending on the underlying implementation of a self hosted cache solution. We use AWS API Gateway which has a hard requirement for `Accept` to determine how it should convert the data. Fixes #33092
1 parent a082693 commit 3f7119a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/nx/src/native/cache/http_remote_cache.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,12 @@ impl HttpRemoteCache {
6767
let _guard = span.enter();
6868

6969
let url: String = format!("{}/v1/cache/{}", self.url, hash);
70-
let response = self.client.get(&url).send().await;
70+
let response = self
71+
.client
72+
.get(&url)
73+
.header("Accept", "application/octet-stream")
74+
.send()
75+
.await;
7176
if let Ok(resp) = response {
7277
trace!("HTTP response status: {}", resp.status());
7378
let status = resp.status();

0 commit comments

Comments
 (0)