Skip to content

Commit a235dca

Browse files
authored
feat: always use https for loremflickr (#1034)
1 parent 9af77dd commit a235dca

1 file changed

Lines changed: 48 additions & 55 deletions

File tree

src/modules/image/index.ts

Lines changed: 48 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ export class Image {
3636
* @param randomize Whether to randomize the image or not. Defaults to `false`.
3737
*
3838
* @example
39-
* faker.image.image() // 'http://loremflickr.com/640/480/city'
40-
* faker.image.image(1234, 2345) // 'http://loremflickr.com/1234/2345/sports'
41-
* faker.image.image(1234, 2345, true) // 'http://loremflickr.com/1234/2345/nature?56789'
39+
* faker.image.image() // 'https://loremflickr.com/640/480/city'
40+
* faker.image.image(1234, 2345) // 'https://loremflickr.com/1234/2345/sports'
41+
* faker.image.image(1234, 2345, true) // 'https://loremflickr.com/1234/2345/nature?56789'
4242
*/
4343
image(width?: number, height?: number, randomize?: boolean): string {
4444
const categories: MethodsOf<Image, Image['image']> = [
@@ -81,29 +81,22 @@ export class Image {
8181
* @param height The height of the image. Defaults to `480`.
8282
* @param category The category of the image. By default, a random one will be selected.
8383
* @param randomize Whether to randomize the image or not. Defaults to `false`.
84-
* @param https When true, return a `https` url. Otherwise, return a `http` url.
8584
*
8685
* @example
87-
* faker.image.imageUrl() // 'http://loremflickr.com/640/480'
88-
* faker.image.imageUrl(1234, 2345) // 'http://loremflickr.com/1234/2345'
89-
* faker.image.imageUrl(1234, 2345, 'cat') // 'http://loremflickr.com/1234/2345/cat'
90-
* faker.image.imageUrl(1234, 2345, 'cat', true) // 'http://loremflickr.com/1234/2345/cat?6849'
91-
* faker.image.imageUrl(1234, 2345, 'cat', true, true) // 'https://loremflickr.com/1234/2345/cat?56789'
86+
* faker.image.imageUrl() // 'https://loremflickr.com/640/480'
87+
* faker.image.imageUrl(1234, 2345) // 'https://loremflickr.com/1234/2345'
88+
* faker.image.imageUrl(1234, 2345, 'cat') // 'https://loremflickr.com/1234/2345/cat'
89+
* faker.image.imageUrl(1234, 2345, 'cat', true) // 'https://loremflickr.com/1234/2345/cat?6849'
9290
*/
9391
imageUrl(
9492
width?: number,
9593
height?: number,
9694
category?: string,
97-
randomize?: boolean,
98-
https?: boolean
95+
randomize?: boolean
9996
): string {
10097
width = width || 640;
10198
height = height || 480;
102-
let protocol = 'http://';
103-
if (https === true) {
104-
protocol = 'https://';
105-
}
106-
let url = `${protocol}loremflickr.com/${width}/${height}`;
99+
let url = `https://loremflickr.com/${width}/${height}`;
107100
if (category != null) {
108101
url += `/${category}`;
109102
}
@@ -123,9 +116,9 @@ export class Image {
123116
* @param randomize Whether to randomize the image or not. Defaults to `false`.
124117
*
125118
* @example
126-
* faker.image.abstract() // 'http://loremflickr.com/640/480/abstract'
127-
* faker.image.abstract(1234, 2345) // 'http://loremflickr.com/1234/2345/abstract'
128-
* faker.image.abstract(1234, 2345, true) // 'http://loremflickr.com/1234/2345/abstract?56789'
119+
* faker.image.abstract() // 'https://loremflickr.com/640/480/abstract'
120+
* faker.image.abstract(1234, 2345) // 'https://loremflickr.com/1234/2345/abstract'
121+
* faker.image.abstract(1234, 2345, true) // 'https://loremflickr.com/1234/2345/abstract?56789'
129122
*/
130123
abstract(width?: number, height?: number, randomize?: boolean): string {
131124
return this.imageUrl(width, height, 'abstract', randomize);
@@ -139,9 +132,9 @@ export class Image {
139132
* @param randomize Whether to randomize the image or not. Defaults to `false`.
140133
*
141134
* @example
142-
* faker.image.animals() // 'http://loremflickr.com/640/480/animals'
143-
* faker.image.animals(1234, 2345) // 'http://loremflickr.com/1234/2345/animals'
144-
* faker.image.animals(1234, 2345, true) // 'http://loremflickr.com/1234/2345/animals?56789'
135+
* faker.image.animals() // 'https://loremflickr.com/640/480/animals'
136+
* faker.image.animals(1234, 2345) // 'https://loremflickr.com/1234/2345/animals'
137+
* faker.image.animals(1234, 2345, true) // 'https://loremflickr.com/1234/2345/animals?56789'
145138
*/
146139
animals(width?: number, height?: number, randomize?: boolean): string {
147140
return this.imageUrl(width, height, 'animals', randomize);
@@ -155,9 +148,9 @@ export class Image {
155148
* @param randomize Whether to randomize the image or not. Defaults to `false`.
156149
*
157150
* @example
158-
* faker.image.business() // 'http://loremflickr.com/640/480/business'
159-
* faker.image.business(1234, 2345) // 'http://loremflickr.com/1234/2345/business'
160-
* faker.image.business(1234, 2345, true) // 'http://loremflickr.com/1234/2345/business?56789'
151+
* faker.image.business() // 'https://loremflickr.com/640/480/business'
152+
* faker.image.business(1234, 2345) // 'https://loremflickr.com/1234/2345/business'
153+
* faker.image.business(1234, 2345, true) // 'https://loremflickr.com/1234/2345/business?56789'
161154
*/
162155
business(width?: number, height?: number, randomize?: boolean): string {
163156
return this.imageUrl(width, height, 'business', randomize);
@@ -171,9 +164,9 @@ export class Image {
171164
* @param randomize Whether to randomize the image or not. Defaults to `false`.
172165
*
173166
* @example
174-
* faker.image.cats() // 'http://loremflickr.com/640/480/cats'
175-
* faker.image.cats(1234, 2345) // 'http://loremflickr.com/1234/2345/cats'
176-
* faker.image.cats(1234, 2345, true) // 'http://loremflickr.com/1234/2345/cats?56789'
167+
* faker.image.cats() // 'https://loremflickr.com/640/480/cats'
168+
* faker.image.cats(1234, 2345) // 'https://loremflickr.com/1234/2345/cats'
169+
* faker.image.cats(1234, 2345, true) // 'https://loremflickr.com/1234/2345/cats?56789'
177170
*/
178171
cats(width?: number, height?: number, randomize?: boolean): string {
179172
return this.imageUrl(width, height, 'cats', randomize);
@@ -187,9 +180,9 @@ export class Image {
187180
* @param randomize Whether to randomize the image or not. Defaults to `false`.
188181
*
189182
* @example
190-
* faker.image.city() // 'http://loremflickr.com/640/480/city'
191-
* faker.image.city(1234, 2345) // 'http://loremflickr.com/1234/2345/city'
192-
* faker.image.city(1234, 2345, true) // 'http://loremflickr.com/1234/2345/city?56789'
183+
* faker.image.city() // 'https://loremflickr.com/640/480/city'
184+
* faker.image.city(1234, 2345) // 'https://loremflickr.com/1234/2345/city'
185+
* faker.image.city(1234, 2345, true) // 'https://loremflickr.com/1234/2345/city?56789'
193186
*/
194187
city(width?: number, height?: number, randomize?: boolean): string {
195188
return this.imageUrl(width, height, 'city', randomize);
@@ -203,9 +196,9 @@ export class Image {
203196
* @param randomize Whether to randomize the image or not. Defaults to `false`.
204197
*
205198
* @example
206-
* faker.image.food() // 'http://loremflickr.com/640/480/food'
207-
* faker.image.food(1234, 2345) // 'http://loremflickr.com/1234/2345/food'
208-
* faker.image.food(1234, 2345, true) // 'http://loremflickr.com/1234/2345/food?56789'
199+
* faker.image.food() // 'https://loremflickr.com/640/480/food'
200+
* faker.image.food(1234, 2345) // 'https://loremflickr.com/1234/2345/food'
201+
* faker.image.food(1234, 2345, true) // 'https://loremflickr.com/1234/2345/food?56789'
209202
*/
210203
food(width?: number, height?: number, randomize?: boolean): string {
211204
return this.imageUrl(width, height, 'food', randomize);
@@ -219,9 +212,9 @@ export class Image {
219212
* @param randomize Whether to randomize the image or not. Defaults to `false`.
220213
*
221214
* @example
222-
* faker.image.nightlife() // 'http://loremflickr.com/640/480/nightlife'
223-
* faker.image.nightlife(1234, 2345) // 'http://loremflickr.com/1234/2345/nightlife'
224-
* faker.image.nightlife(1234, 2345, true) // 'http://loremflickr.com/1234/2345/nightlife?56789'
215+
* faker.image.nightlife() // 'https://loremflickr.com/640/480/nightlife'
216+
* faker.image.nightlife(1234, 2345) // 'https://loremflickr.com/1234/2345/nightlife'
217+
* faker.image.nightlife(1234, 2345, true) // 'https://loremflickr.com/1234/2345/nightlife?56789'
225218
*/
226219
nightlife(width?: number, height?: number, randomize?: boolean): string {
227220
return this.imageUrl(width, height, 'nightlife', randomize);
@@ -235,9 +228,9 @@ export class Image {
235228
* @param randomize Whether to randomize the image or not. Defaults to `false`.
236229
*
237230
* @example
238-
* faker.image.fashion() // 'http://loremflickr.com/640/480/fashion'
239-
* faker.image.fashion(1234, 2345) // 'http://loremflickr.com/1234/2345/fashion'
240-
* faker.image.fashion(1234, 2345, true) // 'http://loremflickr.com/1234/2345/fashion?56789'
231+
* faker.image.fashion() // 'https://loremflickr.com/640/480/fashion'
232+
* faker.image.fashion(1234, 2345) // 'https://loremflickr.com/1234/2345/fashion'
233+
* faker.image.fashion(1234, 2345, true) // 'https://loremflickr.com/1234/2345/fashion?56789'
241234
*/
242235
fashion(width?: number, height?: number, randomize?: boolean): string {
243236
return this.imageUrl(width, height, 'fashion', randomize);
@@ -251,9 +244,9 @@ export class Image {
251244
* @param randomize Whether to randomize the image or not. Defaults to `false`.
252245
*
253246
* @example
254-
* faker.image.people() // 'http://loremflickr.com/640/480/people'
255-
* faker.image.people(1234, 2345) // 'http://loremflickr.com/1234/2345/people'
256-
* faker.image.people(1234, 2345, true) // 'http://loremflickr.com/1234/2345/people?56789'
247+
* faker.image.people() // 'https://loremflickr.com/640/480/people'
248+
* faker.image.people(1234, 2345) // 'https://loremflickr.com/1234/2345/people'
249+
* faker.image.people(1234, 2345, true) // 'https://loremflickr.com/1234/2345/people?56789'
257250
*/
258251
people(width?: number, height?: number, randomize?: boolean): string {
259252
return this.imageUrl(width, height, 'people', randomize);
@@ -267,9 +260,9 @@ export class Image {
267260
* @param randomize Whether to randomize the image or not. Defaults to `false`.
268261
*
269262
* @example
270-
* faker.image.nature() // 'http://loremflickr.com/640/480/nature'
271-
* faker.image.nature(1234, 2345) // 'http://loremflickr.com/1234/2345/nature'
272-
* faker.image.nature(1234, 2345, true) // 'http://loremflickr.com/1234/2345/nature?56789'
263+
* faker.image.nature() // 'https://loremflickr.com/640/480/nature'
264+
* faker.image.nature(1234, 2345) // 'https://loremflickr.com/1234/2345/nature'
265+
* faker.image.nature(1234, 2345, true) // 'https://loremflickr.com/1234/2345/nature?56789'
273266
*/
274267
nature(width?: number, height?: number, randomize?: boolean): string {
275268
return this.imageUrl(width, height, 'nature', randomize);
@@ -283,9 +276,9 @@ export class Image {
283276
* @param randomize Whether to randomize the image or not. Defaults to `false`.
284277
*
285278
* @example
286-
* faker.image.sports() // 'http://loremflickr.com/640/480/sports'
287-
* faker.image.sports(1234, 2345) // 'http://loremflickr.com/1234/2345/sports'
288-
* faker.image.sports(1234, 2345, true) // 'http://loremflickr.com/1234/2345/sports?56789'
279+
* faker.image.sports() // 'https://loremflickr.com/640/480/sports'
280+
* faker.image.sports(1234, 2345) // 'https://loremflickr.com/1234/2345/sports'
281+
* faker.image.sports(1234, 2345, true) // 'https://loremflickr.com/1234/2345/sports?56789'
289282
*/
290283
sports(width?: number, height?: number, randomize?: boolean): string {
291284
return this.imageUrl(width, height, 'sports', randomize);
@@ -299,9 +292,9 @@ export class Image {
299292
* @param randomize Whether to randomize the image or not. Defaults to `false`.
300293
*
301294
* @example
302-
* faker.image.technics() // 'http://loremflickr.com/640/480/technics'
303-
* faker.image.technics(1234, 2345) // 'http://loremflickr.com/1234/2345/technics'
304-
* faker.image.technics(1234, 2345, true) // 'http://loremflickr.com/1234/2345/technics?56789'
295+
* faker.image.technics() // 'https://loremflickr.com/640/480/technics'
296+
* faker.image.technics(1234, 2345) // 'https://loremflickr.com/1234/2345/technics'
297+
* faker.image.technics(1234, 2345, true) // 'https://loremflickr.com/1234/2345/technics?56789'
305298
*/
306299
technics(width?: number, height?: number, randomize?: boolean): string {
307300
return this.imageUrl(width, height, 'technics', randomize);
@@ -315,9 +308,9 @@ export class Image {
315308
* @param randomize Whether to randomize the image or not. Defaults to `false`.
316309
*
317310
* @example
318-
* faker.image.transport() // 'http://loremflickr.com/640/480/transport'
319-
* faker.image.transport(1234, 2345) // 'http://loremflickr.com/1234/2345/transport'
320-
* faker.image.transport(1234, 2345, true) // 'http://loremflickr.com/1234/2345/transport?56789'
311+
* faker.image.transport() // 'https://loremflickr.com/640/480/transport'
312+
* faker.image.transport(1234, 2345) // 'https://loremflickr.com/1234/2345/transport'
313+
* faker.image.transport(1234, 2345, true) // 'https://loremflickr.com/1234/2345/transport?56789'
321314
*/
322315
transport(width?: number, height?: number, randomize?: boolean): string {
323316
return this.imageUrl(width, height, 'transport', randomize);

0 commit comments

Comments
 (0)