@accounts/rest-express
Version:
Server side REST express middleware for accounts
11 lines (9 loc) • 326 B
text/typescript
import type * as express from 'express';
export const getUserAgent = (req: express.Request) => {
let userAgent: string = (req.headers['user-agent'] as string) || '';
if (req.headers['x-ucbrowser-ua']) {
// special case of UC Browser
userAgent = req.headers['x-ucbrowser-ua'] as string;
}
return userAgent;
};