Skip to content

Commit

Permalink
[UXE-5853] fix: Create rule allowed by tuning list (#2013)
Browse files Browse the repository at this point in the history
  • Loading branch information
pauloSF0 authored Dec 12, 2024
1 parent e0b4842 commit c2ebcdc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import { AxiosHttpClientAdapter, parseHttpResponse } from '../axios/AxiosHttpCli
import { makeWafRulesBaseUrl } from './make-waf-rules-base-url'

export const listWafRulesTuningAttacksService = async ({ wafId, tuningId, query }) => {
const trimmedTuningId = tuningId.toString().slice(0, -1)

let httpResponse = await AxiosHttpClientAdapter.request({
url: `${makeWafRulesBaseUrl()}/${wafId}/waf_events/${tuningId}${query}`,
url: `${makeWafRulesBaseUrl()}/${wafId}/waf_events/${trimmedTuningId}${query}`,
method: 'GET'
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ describe('WafRulesService', () => {
body: { results: [fixtures.wafRulesMock] }
})
const { sut } = makeSut()
await sut({ wafId: 4044, query: '?hour_range=48&domains_ids=1705587704', tuningId: 100 })
await sut({ wafId: 4044, query: '?hour_range=48&domains_ids=1705587704', tuningId: 10011 })

expect(requestSpy).toHaveBeenCalledWith({
url: 'v3/waf/4044/waf_events/100?hour_range=48&domains_ids=1705587704',
url: 'v3/waf/4044/waf_events/1001?hour_range=48&domains_ids=1705587704',
method: 'GET'
})
})
Expand All @@ -57,7 +57,7 @@ describe('WafRulesService', () => {
const result = await sut({
wafId: 4044,
query: '?hour_range=48&domains_ids=1705587704',
tuningId: 100
tuningId: 10011
})

expect(result).toEqual([
Expand Down

0 comments on commit c2ebcdc

Please sign in to comment.