mirror of
https://github.com/shivammathur/setup-php.git
synced 2026-09-19 10:41:28 +00:00
Improve code quality and write tests
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
import * as hc from 'typed-rest-client/HttpClient';
|
||||
|
||||
/**
|
||||
* Function to check if PECL extension exists
|
||||
*
|
||||
* @param extension
|
||||
*/
|
||||
export async function checkPECLExtension(extension: string): Promise<boolean> {
|
||||
const http: hc.HttpClient = new hc.HttpClient('shivammathur/php-setup', [], {
|
||||
allowRetries: true,
|
||||
maxRetries: 2
|
||||
});
|
||||
const response: hc.HttpClientResponse = await http.get(
|
||||
'https://pecl.php.net/package/' + extension
|
||||
);
|
||||
return response.message.statusCode === 200;
|
||||
}
|
||||
Reference in New Issue
Block a user