Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ returns the current indexing queue, as an array of objects

## PolicyServer Passthrough

### `HTTP` POST /PolicyServerPassthrough
### `HTTP` POST /api/services/PolicyServerPassthrough

### `P2P` command: PolicyServerPassthrough

Expand Down
4 changes: 3 additions & 1 deletion src/components/httpRoutes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { queueRoutes } from './queue.js'
// import { getConfiguration } from '../../utils/config.js'
import { jobsRoutes } from './jobs.js'
import { addMapping, allRoutesMapping, findPathName } from './routeUtils.js'
import { PolicyServerPassthroughRoute } from './policyServer.js'

export * from './getOceanPeers.js'

Expand Down Expand Up @@ -57,7 +58,8 @@ httpRoutes.use(computeRoutes)
httpRoutes.use(queueRoutes)
// running jobs
httpRoutes.use(jobsRoutes)

// policy server passthrough
httpRoutes.use(PolicyServerPassthroughRoute)
export function getAllServiceEndpoints() {
httpRoutes.stack.forEach(addMapping.bind(null, []))
const data: any = {}
Expand Down
5 changes: 5 additions & 0 deletions src/components/httpRoutes/routeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ routesNames.set('indexQueue', {
method: 'get'
})

routesNames.set('PolicyServerPassthrough', {
path: `${SERVICES_API_BASE_PATH}/PolicyServerPassthrough`,
method: 'post'
})

export function addMapping(path: any, layer: any) {
if (layer.route) {
layer.route.stack.forEach(addMapping.bind(null, path.concat(split(layer.route.path))))
Expand Down
6 changes: 5 additions & 1 deletion src/components/policyServer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ export class PolicyServer {
return { success: true, message: '', httpStatus: 0 }
}
if (response.status === 200) {
return { success: true, message: '', httpStatus: response.status }
return {
success: true,
message: await response.text(),
httpStatus: response.status
}
}
return { success: false, message: await response.text(), httpStatus: response.status }
}
Expand Down
Loading