Merge branch 'fragment-locators' into HEAD
This commit is contained in:
commit
5e516f59c0
22 changed files with 1317 additions and 1280 deletions
|
@ -208,9 +208,25 @@ impl RepoClient {
|
|||
"Authorization",
|
||||
self.installation_token_header(false).await?,
|
||||
);
|
||||
let client = surf::client().with(surf::middleware::Redirect::new(5));
|
||||
|
||||
let client = surf::client();
|
||||
let mut response = client.send(request).await?;
|
||||
|
||||
// Avoid using `surf::middleware::Redirect` because that type forwards
|
||||
// the original request headers to the redirect URI. In this case, the
|
||||
// redirect will be to S3, which forbids us from supplying an
|
||||
// `Authorization` header.
|
||||
if response.status().is_redirection() {
|
||||
if let Some(url) = response.header("location") {
|
||||
let request = surf::get(url.as_str()).header("Accept", "application/octet-stream");
|
||||
response = client.send(request).await?;
|
||||
}
|
||||
}
|
||||
|
||||
if !response.status().is_success() {
|
||||
Err(anyhow!("failed to fetch release asset {} {}", tag, name))?;
|
||||
}
|
||||
|
||||
Ok(response.take_body())
|
||||
}
|
||||
|
||||
|
|
|
@ -1705,27 +1705,27 @@ mod tests {
|
|||
buffer_b.read_with(&cx_b, |buffer, _| {
|
||||
assert_eq!(
|
||||
buffer
|
||||
.diagnostics_in_range(0..buffer.len())
|
||||
.diagnostics_in_range::<_, Point>(0..buffer.len())
|
||||
.collect::<Vec<_>>(),
|
||||
&[
|
||||
(
|
||||
Point::new(0, 4)..Point::new(0, 7),
|
||||
&Diagnostic {
|
||||
DiagnosticEntry {
|
||||
range: Point::new(0, 4)..Point::new(0, 7),
|
||||
diagnostic: Diagnostic {
|
||||
group_id: 0,
|
||||
message: "message 1".to_string(),
|
||||
severity: lsp::DiagnosticSeverity::ERROR,
|
||||
is_primary: true
|
||||
}
|
||||
),
|
||||
(
|
||||
Point::new(0, 10)..Point::new(0, 13),
|
||||
&Diagnostic {
|
||||
},
|
||||
DiagnosticEntry {
|
||||
range: Point::new(0, 10)..Point::new(0, 13),
|
||||
diagnostic: Diagnostic {
|
||||
group_id: 1,
|
||||
severity: lsp::DiagnosticSeverity::WARNING,
|
||||
message: "message 2".to_string(),
|
||||
is_primary: true
|
||||
}
|
||||
)
|
||||
}
|
||||
]
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue