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

Delete the request body when changing the method to "DELETE" #964

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

kusalananda
Copy link
Member

@kusalananda kusalananda commented Aug 22, 2024

Related issue(s) and PR(s)

This PR closes #955

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other

List of changes made

When detecting that a time entry should be deleted, the request body is deleted. This avoids a complaint from any intermediate network proxy from complaining about the request.

How to test

To test the change, you will have to reproduce the error. You can do that by setting up a local HAProxy instance between your Urdr instance and Redmine, like this:

  1. Possibly, create a temporary empty directory and change into it.

  2. Create a HAProxy configuration file, haproxy.cfg, containing the following:

    listen redmine
         bind :80
         mode http
         server localhost 192.168.1.20:3000
    

    Change 192.168.1.20:3000 to the Redmine instance that you want to connect to.

  3. Start the haproxy Docker container running in the background:

    docker run -d --rm -p 3333:80 --name haproxy -v ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro haproxy:lts-alpine
    
  4. Later, when you don't need the container any longer, remove it with:

    docker stop haproxy
    

You should then configure Urdr to connect to your HAProxy instead of Redmine. I do this by setting the relevant variables in urdr.env to point to the HAProxy container's port 3333 (this is 3333 from -p 3333:80 on the command line when the HAProxy container was started):

REDMINE_URL="http://192.168.1.20:3333"
PUBLIC_REDMINE_URL="http://192.168.1.20:3333"

(The IP address 192.168.1.20 is the external IP of my local machine.)

The bug should manifest when you try to remove an existing time entry by setting its hour values to zero in the web UI. Applying the code changes in this PR should fix the issue and you should be able to remove time entries.

Copy link

@pdmnyberg pdmnyberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kusalananda kusalananda merged commit 4f66975 into develop Aug 29, 2024
10 checks passed
@kusalananda kusalananda deleted the 955-delete-payload-fix branch August 29, 2024 17:02
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

Successfully merging this pull request may close these issues.

Deletion of time entries must empty request body
2 participants