mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 06:24:24 +01:00
BIP329: Use application/jsonl as MIME type (#5489)
There's an [ongoing discussion](https://github.com/wardi/jsonlines/issues/19) about what the MIME type for [JSONL](https://jsonlines.org/) files should be. Making it `application/jsonl` leads to the file being downloaded according to my testing, which prevents browsers from opening them in a new window and parsing them as JSON, which fixes #5488.
This commit is contained in:
@@ -1745,20 +1745,15 @@ namespace BTCPayServer.Tests
|
|||||||
Assert.Contains("\"Amount\": \"3.00000000\"", s.Driver.PageSource);
|
Assert.Contains("\"Amount\": \"3.00000000\"", s.Driver.PageSource);
|
||||||
s.Driver.SwitchTo().Window(s.Driver.WindowHandles.First());
|
s.Driver.SwitchTo().Window(s.Driver.WindowHandles.First());
|
||||||
|
|
||||||
// BIP-329 export
|
|
||||||
s.Driver.FindElement(By.Id("ExportDropdownToggle")).Click();
|
|
||||||
s.Driver.FindElement(By.Id("ExportBIP329")).Click();
|
|
||||||
Thread.Sleep(1000);
|
|
||||||
s.Driver.SwitchTo().Window(s.Driver.WindowHandles.Last());
|
|
||||||
Assert.Contains(s.WalletId.ToString(), s.Driver.Url);
|
|
||||||
Assert.EndsWith("export?format=bip329", s.Driver.Url);
|
|
||||||
Assert.Contains("{\"type\":\"tx\",\"ref\":\"", s.Driver.PageSource);
|
|
||||||
s.Driver.SwitchTo().Window(s.Driver.WindowHandles.First());
|
|
||||||
|
|
||||||
// CSV export
|
// CSV export
|
||||||
s.Driver.FindElement(By.Id("ExportDropdownToggle")).Click();
|
s.Driver.FindElement(By.Id("ExportDropdownToggle")).Click();
|
||||||
s.Driver.FindElement(By.Id("ExportCSV")).Click();
|
s.Driver.FindElement(By.Id("ExportCSV")).Click();
|
||||||
s.Driver.SwitchTo().Window(s.Driver.WindowHandles.First());
|
s.Driver.SwitchTo().Window(s.Driver.WindowHandles.First());
|
||||||
|
|
||||||
|
// BIP-329 export
|
||||||
|
s.Driver.FindElement(By.Id("ExportDropdownToggle")).Click();
|
||||||
|
s.Driver.FindElement(By.Id("ExportBIP329")).Click();
|
||||||
|
s.Driver.SwitchTo().Window(s.Driver.WindowHandles.First());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact(Timeout = TestTimeout)]
|
[Fact(Timeout = TestTimeout)]
|
||||||
|
|||||||
@@ -1348,7 +1348,7 @@ namespace BTCPayServer.Controllers
|
|||||||
{
|
{
|
||||||
"csv" => "text/csv",
|
"csv" => "text/csv",
|
||||||
"json" => "application/json",
|
"json" => "application/json",
|
||||||
"bip329" => "text/jsonl", // https://stackoverflow.com/questions/59938644/what-is-the-mime-type-of-jsonl-files
|
"bip329" => "application/jsonl", // Ongoing discussion: https://github.com/wardi/jsonlines/issues/19
|
||||||
_ => throw new ArgumentOutOfRangeException(nameof(format), format, null)
|
_ => throw new ArgumentOutOfRangeException(nameof(format), format, null)
|
||||||
};
|
};
|
||||||
var cd = new ContentDisposition
|
var cd = new ContentDisposition
|
||||||
|
|||||||
Reference in New Issue
Block a user