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

Include trailing slash and disable compression #9

Merged
merged 1 commit into from
May 14, 2024
Merged

Conversation

sevein
Copy link
Member

@sevein sevein commented May 14, 2024

I've run into more issues with the client when trying to copy files between locations.

  • The default redirect handler in Kiota returns an error when sending a POST because the data we're sending can't be kept. This is actually a problem in TypeSpec because I haven't been able to describe paths with a trailing slash. While I'm hoping they can fix that in the openapi3 emitter at some point, what I've done in this PR is to inject a new middleware that introduces the trailing slash when needed.
  • Compression was enabled by default and that was a problem in Storage Service because it wasn't handling the payload in my development environment. I've temporarily disabled it.

This is now working for me:

origin := "/api/v2/location/5cbbf1f6-7abe-474e-8dda-9904083a1831/"
pipeline := "/api/v2/pipeline/97c991c6-432f-4e45-9f58-e6f432b62a97/"

var body models.MoveRequestable = models.NewMoveRequest()
body.SetOriginLocation(&origin)
body.SetPipeline(&pipeline)

moves := []models.MoveFileable{
	{
		move := &models.MoveFile{}
		src := "test"
		dst := "test"
		move.SetSource(&src)
		move.SetDestination(&dst)
		moves = append(moves, move)
	}
}
body.SetFiles(moves)

bytes, err := app.client.Location().ByUuid("df192133-3b13-4292-a219-50887d285cb3").Post(ctx, body, nil)

@sevein sevein merged commit 097cc18 into main May 14, 2024
6 checks passed
@sevein sevein deleted the dev/fix-move-files branch May 14, 2024 10:18
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.

1 participant