Add User-Agent rule for Nx client

Closes gh-1143
This commit is contained in:
Stephane Nicoll 2020-11-03 09:56:37 +01:00
parent 4c78853399
commit aa2570468a
2 changed files with 14 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -108,6 +108,11 @@ public class Agent {
*/
JENKINSX("jenkinsx", "jx"),
/**
* NX.
*/
NX("nx", "@nxrocks_nx-spring-boot"),
/**
* A generic browser.
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -97,6 +97,13 @@ class AgentTests {
assertThat(agent.getVersion()).isEqualTo("1.1.71");
}
@Test
void checkNx() {
Agent agent = Agent.fromUserAgent("@nxrocks_nx-spring-boot/1.0.0");
assertThat(agent.getId()).isEqualTo(Agent.AgentId.NX);
assertThat(agent.getVersion()).isEqualTo("1.0.0");
}
@Test
void checkGenericBrowser() {
Agent agent = Agent.fromUserAgent("Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MMB29K) ");