Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support filtering data #19

Open
hg-pyun opened this issue Jun 29, 2019 · 1 comment
Open

Support filtering data #19

hg-pyun opened this issue Jun 29, 2019 · 1 comment
Assignees

Comments

@hg-pyun
Copy link
Owner

hg-pyun commented Jun 29, 2019

Feature

  • Support Filtering data/head
const config = {
  dataFilter: regex
  headFilter: ['custom-header'] 
}

output

prefix url response-code filtered-head filtered-data
@hg-pyun hg-pyun self-assigned this Nov 3, 2019
@hg-pyun hg-pyun mentioned this issue Nov 3, 2019
2 tasks
@probablykabari
Copy link

You can do this currently by making an interceptor function and passing the filtered request/response to the logger. All it does is print and return the request that was passed.

axios.interceptors.request.use((request) => {
	const { password: _ignored1, ...filteredData } = request.data 
	const { password: _ignored2, ...filteredParams } = request.params

	const filteredRequest = { ...request, data: filteredData, params: filteredParams }

	AxiosLogger.requestLogger(filteredRequest)
	
	return request // still send axios the unfiltered version
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants