Bogus
Bogus copied to clipboard
picsum requests are outdated
Version Information
Software | Version(s) |
---|---|
Bogus NuGet Package | 34.0.2 |
What is the expected behavior?
Expected is that Bogus will create a link based on the picsum.photos documentation.
https://picsum.photos/id/69/640/480
What is the actual behavior?
A link is created with ?image=id
, which is outdated. It is possible that this request will not be possible anymore at some point.
https://picsum.photos/640/480/?image=69
Any possible solutions?
Specify the Id
via the ULR and not as a parameter:
(Important: grayscale should be specified via a parameter, however, according to the docu...)
public string PicsumUrl(int width = 640, int height = 480, bool grayscale = false, bool blur = false, int? imageId = null)
{
const string Url = "https://picsum.photos";
var sb = new StringBuilder(Url);
var n = imageId ?? this.Random.Number(0, 1084);
sb.Append($"/id/{n}");
sb.Append($"/{width}/{height}");
if (grayscale)
{
sb.Append("?grayscale");
}
if (blur)
{
sb.Append(grayscale ? "&" : "?");
sb.Append("blur");
}
return sb.ToString();
}
How do you reproduce the issue?
Create a picsum link via Bogus.
Can you identify the location in Bogus' source code where the problem exists?
sb.Append($"/?image={n}");
If the bug is confirmed, would you be willing to submit a PR?
No, because my recommended solution can already be found here in this report. Thus, this only needs to be added / overwritten.
In addition, the service lorempixel is no longer available / does not respond.
I think we'll need to remove the LoremPixel service in our next major update. Thank you for reporting.
I will take this, will raise PR soon