Skip to content

Commit a8decd8

Browse files
committed
refactor(api): standardize request header key prefixes
- Introduce COSEC_EXTEND_KEY_PREFIX constant for consistent header naming - Update AppIdCapable to use prefixed header key format - Update DeviceIdCapable to use prefixed header key format - Update RequestIdCapable to use prefixed header key format - Update SpaceIdCapable to use prefixed header key format - Create new ExtendKey.kt file with prefix constant definition Signed-off-by: Ahoo Wang <ahoowang@qq.com>
1 parent 8e4af7e commit a8decd8

File tree

5 files changed

+20
-4
lines changed

5 files changed

+20
-4
lines changed

cosec-api/src/main/kotlin/me/ahoo/cosec/api/context/request/AppIdCapable.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ typealias AppId = String
1717

1818
interface AppIdCapable {
1919
companion object {
20-
const val APP_ID_KEY = "CoSec-App-Id"
20+
const val APP_ID_KEY = "${COSEC_EXTEND_KEY_PREFIX}App-Id"
2121
}
2222

2323
val appId: AppId

cosec-api/src/main/kotlin/me/ahoo/cosec/api/context/request/DeviceIdCapable.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ typealias DeviceId = String
1717

1818
interface DeviceIdCapable {
1919
companion object {
20-
const val DEVICE_ID_KEY = "CoSec-Device-Id"
20+
const val DEVICE_ID_KEY = "${COSEC_EXTEND_KEY_PREFIX}Device-Id"
2121
}
2222
val deviceId: DeviceId
2323
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
* Unless required by applicable law or agreed to in writing, software
8+
* distributed under the License is distributed on an "AS IS" BASIS,
9+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
* See the License for the specific language governing permissions and
11+
* limitations under the License.
12+
*/
13+
14+
package me.ahoo.cosec.api.context.request
15+
16+
const val COSEC_EXTEND_KEY_PREFIX = "CoSec-"

cosec-api/src/main/kotlin/me/ahoo/cosec/api/context/request/RequestIdCapable.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ typealias RequestId = String
1717

1818
interface RequestIdCapable {
1919
companion object {
20-
const val REQUEST_ID_KEY = "CoSec-Request-Id"
20+
const val REQUEST_ID_KEY = "${COSEC_EXTEND_KEY_PREFIX}Request-Id"
2121
}
2222

2323
val requestId: RequestId

cosec-api/src/main/kotlin/me/ahoo/cosec/api/context/request/SpaceIdCapable.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ typealias SpaceId = String
1717

1818
interface SpaceIdCapable {
1919
companion object {
20-
const val SPACE_ID_KEY = "CoSec-Space-Id"
20+
const val SPACE_ID_KEY = "${COSEC_EXTEND_KEY_PREFIX}Space-Id"
2121
const val DEFAULT = ""
2222
}
2323

0 commit comments

Comments
 (0)