foss42 / apidash

API Dash is a beautiful open-source cross-platform API Client built using Flutter which can help you easily create & customize your API requests, visually inspect responses and generate API integration code. A lightweight alternative to postman/insomnia.
https://apidash.dev
Apache License 2.0
1.37k stars 257 forks source link

refine header suggestions using FuzzyOptions #376

Closed PratyushChauhan closed 3 months ago

PratyushChauhan commented 3 months ago

PR Description

This PR adds fuzzy logic while getting header suggestions. I have reviewed the previous PR and have used FuzzyOptions to filter out irrelevant results.

Related Issues

Checklist

Added/updated tests?

We encourage you to add relevant test cases.

PratyushChauhan commented 3 months ago

I noticed that upon typing Allow-Methods it does not return Access-Control-Allow-Methods . Finding a fix for this rn.

PratyushChauhan commented 3 months ago

Added tests that are identical to the previous suggestion functions. However there are some failed test cases.

For example here, the Access-Control-Allow-Headers pattern should only return one element but it returns 4. Currently working to pass this test case. This is most likely due to the large edit distance of 50.

Testing getFuzzyHeaderSuggestions function Testing using Access-Control-Allow-Headers [E]
  Expected: ['Access-Control-Allow-Headers']
    Actual: [
              'Access-Control-Allow-Headers',
              'Access-Control-Allow-Methods',
              'Access-Control-Allow-Origin',
              'Access-Control-Request-Headers'
            ]
animator commented 3 months ago

It is currently not performing better than the existing solution. Also, the tests are failing. The purpose is to provide better results, so make sure you test it thoroughly for different scenarios and provide a short description in the PR next time describing where it is performing better than the existing implementation. Closing this PR.

PratyushChauhan commented 3 months ago

Continued in pr #380