sptc 0.0.16 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/httpServer.js +7 -0
- package/dist/router.s +6 -5
- package/package.json +1 -1
package/dist/httpServer.js
CHANGED
|
@@ -123,6 +123,13 @@ function buildRequestContext(req, res, {srvDir, debug, env, isRouterMode}) {
|
|
|
123
123
|
reqCtx.setResponseHeaders=headers=>{
|
|
124
124
|
Object.assign(state.responseHeaders, headers)
|
|
125
125
|
}
|
|
126
|
+
reqCtx.getStatus=_=>{
|
|
127
|
+
return [state.statusCode, state.statusText]
|
|
128
|
+
}
|
|
129
|
+
reqCtx.getResponseHeaders=_=>{
|
|
130
|
+
return state.responseHeaders
|
|
131
|
+
}
|
|
132
|
+
|
|
126
133
|
reqCtx.flushHeader=_=>{
|
|
127
134
|
flushHeader()
|
|
128
135
|
}
|
package/dist/router.s
CHANGED
|
@@ -5,11 +5,12 @@ const {$error, $alias, $index_action}=include(__SETTING__)
|
|
|
5
5
|
function resolve(pathname) {
|
|
6
6
|
let _pathname=pathname
|
|
7
7
|
for(let a in $alias) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
let p=a.replace(/\*/g, '(.*?)')
|
|
9
|
+
const sub=pathname.match(new RegExp('^'+p+'$'))
|
|
10
|
+
if(sub) {
|
|
11
|
+
_pathname=$alias[a]
|
|
12
|
+
$_REQUEST_FILE['subRoute']=sub
|
|
13
|
+
break
|
|
13
14
|
}else if(a===pathname) {
|
|
14
15
|
_pathname=$alias[a]
|
|
15
16
|
break
|