Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
ui-middleware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open Source Software
OX App Suite
Core
ui-middleware
Commits
d98ba424
Commit
d98ba424
authored
3 years ago
by
richard.petersen
Browse files
Options
Downloads
Patches
Plain Diff
Introduce redirect endpoint for login redirects
parent
636f711f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
spec/redirect_test.js
+35
-0
35 additions, 0 deletions
spec/redirect_test.js
src/createApp.js
+6
-0
6 additions, 0 deletions
src/createApp.js
yarn.lock
+151
-137
151 additions, 137 deletions
yarn.lock
with
192 additions
and
137 deletions
spec/redirect_test.js
0 → 100644
+
35
−
0
View file @
d98ba424
import
request
from
'
supertest
'
import
{
generateSimpleViteManifest
,
mockConfig
,
mockFetch
,
mockApp
}
from
'
./util.js
'
import
{
expect
}
from
'
chai
'
import
*
as
td
from
'
testdouble
'
describe
(
'
Redirects
'
,
function
()
{
let
app
before
(
async
function
()
{
mockConfig
({
urls
:
[
'
http://ui-server/
'
]
})
mockFetch
({
'
http://ui-server
'
:
{
'
/manifest.json
'
:
generateSimpleViteManifest
({
'
example.js
'
:
'
test
'
}),
'
/example.js
'
:
''
}
})
app
=
await
mockApp
()
})
after
(
function
()
{
td
.
reset
()
})
it
(
'
without requested location
'
,
async
function
()
{
const
response
=
await
request
(
app
).
post
(
'
/redirect
'
)
expect
(
response
.
statusCode
).
to
.
equal
(
302
)
expect
(
response
.
headers
.
location
).
to
.
equal
(
'
../busy.html
'
)
})
it
(
'
with requested location
'
,
async
function
()
{
const
response
=
await
request
(
app
).
post
(
'
/redirect
'
).
send
(
'
location=/appsuite/whatever/path
'
)
expect
(
response
.
statusCode
).
to
.
equal
(
302
)
expect
(
response
.
headers
.
location
).
to
.
equal
(
'
/appsuite/whatever/path
'
)
})
})
This diff is collapsed.
Click to expand it.
src/createApp.js
+
6
−
0
View file @
d98ba424
...
...
@@ -35,6 +35,7 @@ export function createApp () {
// The app returned by express() is in fact a JavaScript Function, designed to be passed to Node’s HTTP servers as a callback to handle requests.
const
app
=
express
()
app
.
use
(
express
.
urlencoded
({
extended
:
true
}))
const
healthCheck
=
new
health
.
HealthChecker
()
const
startupCheck
=
new
health
.
StartupCheck
(
'
warmup cache
'
,
async
function
()
{
...
...
@@ -109,6 +110,11 @@ export function createApp () {
next
()
})
app
.
post
(
'
/redirect
'
,
(
req
,
res
,
next
)
=>
{
const
location
=
req
.
body
.
location
||
'
../busy.html
'
res
.
redirect
(
location
)
})
app
.
use
(
async
(
req
,
res
,
next
)
=>
{
const
{
'
content-type
'
:
contentType
,
content
}
=
fileCache
.
get
(
req
.
path
)
if
(
content
)
{
...
...
This diff is collapsed.
Click to expand it.
yarn.lock
+
151
−
137
View file @
d98ba424
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment