-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
👽 Tester ut nye endepunkter for les og slett av filer
- Loading branch information
Showing
4 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { getStringFromPossiblyArrayQuery } from '@navikt/aap-felles-utils-client'; | ||
import { beskyttetApi, getAccessTokenFromRequest, tokenXApiProxy } from '@navikt/aap-felles-utils'; | ||
|
||
const handler = beskyttetApi(async (req, res) => { | ||
const uuid = getStringFromPossiblyArrayQuery(req.query.uuid); | ||
if (!uuid) { | ||
res.status(400).json({ error: 'uuid må være en string' }); | ||
} | ||
const accessToken = getAccessTokenFromRequest(req); | ||
return await tokenXApiProxy({ | ||
url: `/mellomlagring/fil/${uuid}`, | ||
method: 'GET', | ||
prometheusPath: '/mellomlagring/fil', | ||
req: req, | ||
audience: process.env.INNSENDING_URL!, | ||
bearerToken: accessToken, | ||
}); | ||
}); | ||
|
||
export const config = { | ||
api: { | ||
responseLimit: '50mb', | ||
}, | ||
}; | ||
|
||
export default handler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { getStringFromPossiblyArrayQuery } from '@navikt/aap-felles-utils-client'; | ||
import { beskyttetApi, getAccessTokenFromRequest, tokenXApiProxy } from '@navikt/aap-felles-utils'; | ||
|
||
const handler = beskyttetApi(async (req, res) => { | ||
const uuid = getStringFromPossiblyArrayQuery(req.query.uuid); | ||
if (!uuid) { | ||
res.status(400).json({ error: 'uuid må være en string' }); | ||
} | ||
const accessToken = getAccessTokenFromRequest(req); | ||
return await tokenXApiProxy({ | ||
url: `/mellomlagring/fil/${uuid}`, | ||
method: 'DELETE', | ||
prometheusPath: '/mellomlagring/fil', | ||
req, | ||
audience: process.env.INNSENDING_URL!, | ||
bearerToken: accessToken, | ||
}); | ||
}); | ||
|
||
export default handler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters