Skip to content

Commit

Permalink
Port remote-ip.js to TypeScript (#51130)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbe authored Jun 12, 2024
1 parent e91c1fe commit 11fee45
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/frame/middleware/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import archivedEnterpriseVersionsAssets from '@/archives/middleware/archived-ent
import api from './api'
import healthz from './healthz'
import manifestJson from './manifest-json'
import remoteIP from './remote-ip.js'

This comment was marked as spam.

Copy link
@Jmiller133

Jmiller133 Jun 29, 2024

node.js

This comment was marked as spam.

Copy link
@Jmiller133

Jmiller133 Jun 29, 2024

Do we want the red out of here, and how

This comment was marked as spam.

Copy link
@Jmiller133

Jmiller133 Jun 29, 2024

[maintainer edit for spammy content]

import remoteIP from './remote-ip'
import buildInfo from './build-info.js'
import archivedEnterpriseVersions from '@/archives/middleware/archived-enterprise-versions.js'
import robots from './robots.js'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type { Request, Response } from 'express'

import { noCacheControl } from './cache-control.js'

export default function remoteIp(req, res) {
export default function remoteIp(req: Request, res: Response) {
noCacheControl(res)
res.json({
ip: req.ip,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, test, vi } from 'vitest'

import { get } from '#src/tests/helpers/e2etest.js'
import { get } from '@/tests/helpers/e2etest.js'

describe('remote ip debugging', () => {
vi.setConfig({ testTimeout: 60 * 1000 })
Expand Down
2 changes: 1 addition & 1 deletion src/tests/helpers/e2etest.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export async function get(
body = undefined,
followRedirects = false,
followAllRedirects = false,
headers = undefined,
headers = {},
responseType = '',
retries = 0,
} = {},
Expand Down

0 comments on commit 11fee45

Please sign in to comment.