Allow extensions to control the redirect policy for the HTTP client (#16162)
This PR extends the extension API with support for controlling the redirect policy used by the HTTP client. Release Notes: - N/A
This commit is contained in:
parent
98a2ab0686
commit
4450ebff6b
5 changed files with 42 additions and 14 deletions
|
@ -4,7 +4,8 @@ use std::{fs, io};
|
|||
use zed::lsp::CompletionKind;
|
||||
use zed::{
|
||||
CodeLabel, CodeLabelSpan, HttpMethod, HttpRequest, KeyValueStore, LanguageServerId,
|
||||
SlashCommand, SlashCommandArgumentCompletion, SlashCommandOutput, SlashCommandOutputSection,
|
||||
RedirectPolicy, SlashCommand, SlashCommandArgumentCompletion, SlashCommandOutput,
|
||||
SlashCommandOutputSection,
|
||||
};
|
||||
use zed_extension_api::{self as zed, Result};
|
||||
|
||||
|
@ -208,6 +209,7 @@ impl zed::Extension for GleamExtension {
|
|||
"Zed (Gleam Extension)".to_string(),
|
||||
)],
|
||||
body: None,
|
||||
redirect_policy: RedirectPolicy::FollowAll,
|
||||
})?;
|
||||
|
||||
let (markdown, _modules) =
|
||||
|
|
|
@ -10,7 +10,9 @@ use html_to_markdown::{
|
|||
convert_html_to_markdown, HandleTag, HandlerOutcome, HtmlElement, MarkdownWriter,
|
||||
StartTagOutcome, TagHandler,
|
||||
};
|
||||
use zed_extension_api::{self as zed, HttpMethod, HttpRequest, KeyValueStore, Result};
|
||||
use zed_extension_api::{
|
||||
self as zed, HttpMethod, HttpRequest, KeyValueStore, RedirectPolicy, Result,
|
||||
};
|
||||
|
||||
pub fn index(package: String, database: &KeyValueStore) -> Result<()> {
|
||||
let headers = vec![(
|
||||
|
@ -23,6 +25,7 @@ pub fn index(package: String, database: &KeyValueStore) -> Result<()> {
|
|||
url: format!("https://hexdocs.pm/{package}"),
|
||||
headers: headers.clone(),
|
||||
body: None,
|
||||
redirect_policy: RedirectPolicy::FollowAll,
|
||||
})?;
|
||||
|
||||
let (package_root_markdown, modules) =
|
||||
|
@ -36,6 +39,7 @@ pub fn index(package: String, database: &KeyValueStore) -> Result<()> {
|
|||
url: format!("https://hexdocs.pm/{package}/{module}.html"),
|
||||
headers: headers.clone(),
|
||||
body: None,
|
||||
redirect_policy: RedirectPolicy::FollowAll,
|
||||
})?;
|
||||
|
||||
let (markdown, _modules) =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue